diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py new file mode 100644 index 0000000..63d2cca --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py @@ -0,0 +1,418 @@ +from gen_ai_hub.document_grounding_generation.client import GroundingApiClient +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi +from gen_ai_hub.document_grounding_generation.generated.models import ( # noqa: F401 + ApiError, + BaseDocument, + BasePipelineMinimalResponse, + BasePipelineResponse, + BatchUpdateDocumentSuccess, + BatchUpdateDocumentsResponseInner, + BinaryBooleanFilter, + BoostingScoreComputationStrategy, + BoostingScoringConfiguration, + BoostingScoringConfigurationMetadataInner, + Chunk, + Collection, + CollectionCreatedResponse, + CollectionDeletedResponse, + CollectionPendingResponse, + CollectionRequest, + CollectionsListResponse, + ConfigurationDocument, + ConfigurationDocumentFullDetails, + CreatePipeline, + DataRepositories, + DataRepository, + DataRepositoryPerFilterSearchResult, + DataRepositorySearchResult, + DataRepositorySearchResults, + DataRepositoryType, + DataRepositoryWithDocuments, + DenseRetrievalScoringConfiguration, + DetailsErrorResponse, + Document, + DocumentBulkDeleteRequest, + DocumentBulkDeleteResponse, + DocumentCreateRequest, + DocumentInput, + DocumentKeyValueListPair, + DocumentMetadata, + DocumentMetadataBatchRequest, + DocumentMetadataUpdate, + DocumentMetadataUpdateError, + DocumentOutput, + DocumentResponse, + DocumentStatus, + DocumentUpdateRequest, + DocumentWithoutChunks, + Documents, + DocumentsChunk, + DocumentsListResponse, + DocumentsStatusResponse, + DocumentsStatusResponseResourcesInner, + EmbeddingConfig, + ErrorResponse, + Filter, + FilterMatchModeEnum, + FiltersInner, + GenericError, + GetAllPipelines400Response, + GetCollectionCreationStatus200Response, + GetCollectionDeletionStatus200Response, + GetPipeline, + GetPipelineExecutionById, + GetPipelineExecutions, + GetPipelineStatus, + GetPipelines, + GoogleDriveConfig, + GoogleDriveConfigurationMinimal, + GoogleDriveConfigurationStruct, + GoogleDrivePipelineCreateRequest, + GoogleDrivePipelineGetResponse, + GoogleDrivePipelineMinimalResponse, + GoogleDriveResourceDetail, + HTTPValidationError, + KeyValueListPair, + KeyWordRetrievalScoringConfiguration, + Left, + Left1, + ListConfigurationDocuments, + ListConfigurationDocumentsFullDetails, + ListMetadataConfigurations, + LocationInner, + ManualPipelineTrigger, + MergeStrategyReranker, + MergeStrategyRerankerBoostingInner, + MergeStrategyScoreReuse, + MergeStrategyType, + MessageResponse, + MSSharePointConfiguration, + MSSharePointConfigurationGetResponse, + MSSharePointConfigurationMinimal, + MSSharePointPipelineCreateRequest, + MSSharePointPipelineGetResponse, + MSSharePointPipelineMinimalResponse, + MetaData, + MetaDataDataRepositoryMetadataInner, + MetaDataKeyValuePairStrict, + MetadataConfiguration, + MetadataConfigurationMetadata, + MetadataConfigurationRequest, + MetadataConfigurationRequestLabelsInner, + MetadataConfigurationResponse, + MetadataConfigurationStruct, + MetadataItem, + MetadataKeyUpdate, + MetadataOperation, + MetadataOperationEnum, + MetadataResponse, + MetadataUpdateItem, + MetadataUpdates, + PatchPipeline, + PatchPipelineConfiguration, + PatchPipelineMetadata, + PerFilterSearchResult, + PerFilterSearchResultError, + PerFilterSearchResultWithError, + PipelineDocumentResponse, + PipelineExecutionData, + PipelineExecutionStatus, + PipelineId, + PipelineMinimalResponse, + PostProcessingObjectReference, + PostProcessingOperation, + ResultsInner, + ResultsInner1, + ResultsInner2, + RetrievalBinaryBooleanFilter, + RetrievalChunk, + RetrievalDataRepositorySearchResult, + RetrievalDocumentKeyValueListPair, + RetrievalKeyValueListPair, + RetrievalPerFilterSearchResult, + RetrievalPerFilterSearchResultError, + RetrievalPerFilterSearchResultWithError, + RetrievalScopedKeyValueListPair, + RetrievalSearchConfiguration, + RetrievalSearchDocumentKeyValueListPair, + RetrievalSearchFilter, + RetrievalSearchInput, + RetrievalSearchInputPostProcessingInner, + RetrievalSearchInputPostProcessingInnerInputsInner, + RetrievalSearchInputPostProcessingInnerStrategy, + RetrievalSearchResults, + RetrievalSearchSelectOptionEnum, + RetrievalVectorSearchFilter, + RetrievalVectorSearchFilterFilter, + Right, + Right1, + S3Configuration, + S3ConfigurationMinimal, + S3PipelineCreateRequest, + S3PipelineGetResponse, + S3PipelineMinimalResponse, + SDMPipelineCreateRequest, + SDMPipelineGetResponse, + SDMPipelineMinimalResponse, + SFTPConfiguration, + SFTPConfigurationMinimal, + SFTPPipelineCreateRequest, + SFTPPipelineGetResponse, + SFTPPipelineMinimalResponse, + ScopedKeyValueListPair, + Score, + ScoresAggregationStrategy, + SearchConfiguration, + SearchDocumentKeyValueListPair, + SearchFilter, + SearchPipeline, + SearchPipelinesResponse, + SearchResults, + SearchScores, + SearchScoresAggregatedScore, + SearchSelectOptionEnum, + ServiceNowConfig, + ServiceNowConfigurationMinimal, + ServiceNowConfigurationMinimalServiceNow, + ServiceNowConfigurationStruct, + ServiceNowPipelineCreateRequest, + ServiceNowPipelineGetResponse, + ServiceNowPipelineMinimalResponse, + SharePointConfig, + SharePointConfigGetResponse, + SharePointSite, + SharePointSiteDetail, + SharePointSiteGetResponse, + Strategy, + TextOnlyBaseChunk, + TextOnlyBaseChunkCreate, + TextSearchRequest, + ValidationError, + VectorChunk, + VectorDocumentKeyValueListPair, + VectorKeyValueListPair, + VectorPerFilterSearchResult, + VectorScoringConfiguration, + VectorSearchConfiguration, + VectorSearchDocumentKeyValueListPair, + VectorSearchFilter, + VectorSearchResults, + VectorSearchSelectOptionEnum, + WorkZonePipelineCreateRequest, + WorkZonePipelineGetResponse, + WorkZonePipelineMinimalResponse, +) + +__all__ = [ + # Client + "GroundingApiClient", + # API classes + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + # Models + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/client.py b/packages/gen/gen_ai_hub/document_grounding_generation/client.py new file mode 100644 index 0000000..8a9521a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/client.py @@ -0,0 +1,63 @@ +"""SAP AI Core authentication wiring for the generated document grounding client. + +Subclasses the generated RESTClientObject and ApiClient to inject auth headers +from an AiCoreV2Client or GenAIHubProxyClient via httpx event hooks — the same +pattern used in packages/gen (PR #44 utils.py). + +Usage: + from ai_core_sdk.ai_core_v2_client import AICoreV2Client + from gen_ai_hub.document_grounding_generation import GroundingApiClient, VectorApi + + client = GroundingApiClient(AICoreV2Client.from_env()) + collections = await VectorApi(client).get_all_collections( + header_parameters={"AI-Resource-Group": "default"} + ) +""" + +from __future__ import annotations + +from typing import Any + +import httpx + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration +from gen_ai_hub.document_grounding_generation.generated.rest import RESTClientObject + + +def _make_auth_hook(proxy_client: Any): + """Return an httpx request event hook that injects SAP AI Core auth headers.""" + + async def inject_auth(request: httpx.Request) -> None: + for key, value in proxy_client.request_header.items(): + request.headers[key] = value + + return inject_auth + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, proxy_client: Any) -> None: + super().__init__(configuration) + self._proxy_client = proxy_client + + def _create_pool_manager(self) -> httpx.AsyncClient: + return httpx.AsyncClient( + event_hooks={"request": [_make_auth_hook(self._proxy_client)]} + ) + + +class GroundingApiClient(ApiClient): + """ApiClient pre-wired with SAP AI Core authentication. + + Args: + proxy_client: An AICoreV2Client or GenAIHubProxyClient instance. + Its request_header property is called per-request to inject + Authorization and AI-* headers. + base_url: Optional override for the service base URL. Defaults to the + basePath baked into Configuration (/lm/document-grounding). + """ + + def __init__(self, proxy_client: Any, base_url: str | None = None) -> None: + config = Configuration(host=base_url) if base_url else Configuration() + super().__init__(configuration=config) + self.rest_client = _SapRESTClientObject(config, proxy_client) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py new file mode 100644 index 0000000..17c372a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py @@ -0,0 +1,454 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] + +# import apis into sdk package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi as MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi as PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi as RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi as VectorApi + +# import ApiClient +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse as ApiResponse +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient as ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration as Configuration +from gen_ai_hub.document_grounding_generation.generated.exceptions import OpenApiException as OpenApiException +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiTypeError as ApiTypeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiValueError as ApiValueError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiKeyError as ApiKeyError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiAttributeError as ApiAttributeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException as ApiException + +# import models into sdk package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError as ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument as BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse as BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse as BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess as BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner as BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter as BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy as BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration as BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner as BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk as Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection as Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse as CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse as CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse as CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest as CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse as CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument as ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails as ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline as CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories as DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository as DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult as DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult as DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults as DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType as DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments as DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration as DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse as DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document as Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest as DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse as DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest as DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput as DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair as DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata as DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest as DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate as DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError as DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput as DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse as DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus as DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest as DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks as DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents as Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk as DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse as DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse as DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner as DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig as EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse as ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter as Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum as FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner as FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError as GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response as GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response as GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response as GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline as GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById as GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions as GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus as GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines as GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig as GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal as GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct as GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest as GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse as GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse as GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail as GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError as HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair as KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration as KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left as Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 as Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments as ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails as ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations as ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner as LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration as MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse as MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal as MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest as MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse as MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse as MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger as ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker as MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner as MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse as MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType as MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse as MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData as MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner as MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict as MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration as MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata as MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest as MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner as MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse as MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct as MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem as MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate as MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation as MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum as MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse as MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem as MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates as MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline as PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration as PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata as PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult as PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError as PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError as PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse as PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData as PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus as PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId as PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse as PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference as PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation as PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner as ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 as ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 as ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter as RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk as RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult as RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair as RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair as RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult as RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError as RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError as RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair as RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration as RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair as RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter as RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput as RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner as RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner as RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy as RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults as RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum as RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter as RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter as RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right as Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 as Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration as S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal as S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest as S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse as S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse as S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest as SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse as SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse as SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration as SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal as SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest as SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse as SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse as SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair as ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score as Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy as ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration as SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair as SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter as SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline as SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse as SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults as SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores as SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore as SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum as SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig as ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal as ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow as ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct as ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest as ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse as ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse as ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig as SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse as SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite as SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail as SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse as SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy as Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk as TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate as TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest as TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError as ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk as VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair as VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair as VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult as VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration as VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration as VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair as VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter as VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults as VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum as VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest as WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse as WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse as WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py new file mode 100644 index 0000000..2f6ec93 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py @@ -0,0 +1,8 @@ +# flake8: noqa + +# import apis into api package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py new file mode 100644 index 0000000..320e4a0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py @@ -0,0 +1,2054 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 + + +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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_metadata_configurations_serialize( + self, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py new file mode 100644 index 0000000..625db20 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py @@ -0,0 +1,4340 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 + + +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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_pipelines_by_metadata_serialize( + self, + ai_resource_group, + search_pipeline, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if search_pipeline is not None: + _body_params = search_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py new file mode 100644 index 0000000..092f015 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py @@ -0,0 +1,951 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 + + +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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_serialize( + self, + ai_resource_group, + retrieval_search_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if retrieval_search_input is not None: + _body_params = retrieval_search_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/retrieval/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py new file mode 100644 index 0000000..952791a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -0,0 +1,4840 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 + + +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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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-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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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-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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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-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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + 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 + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + 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 = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_documents_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/documents/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py new file mode 100644 index 0000000..48d58fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py @@ -0,0 +1,833 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @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 + + 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 = 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(generated.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py new file mode 100644 index 0000000..209bed8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py @@ -0,0 +1,654 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 copy +import http.client as httplib +import logging +from logging import FileHandler +import multiprocessing +import ssl +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from urllib.parse import urlparse +from urllib.request import getproxies +from typing_extensions import NotRequired, Self + +import urllib3 + + +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 | urllib3.util.retry.Retry - 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 no_proxy: Comma-separated hosts that bypass the proxy. + :param proxy_headers: Proxy headers. + :param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings. + :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[Union[int, urllib3.util.retry.Retry]] = 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, + no_proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + proxy_ssl_context: Optional[ssl.SSLContext]=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["urllib3_logger"] = logging.getLogger("urllib3") + 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 multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. None in the constructor is coerced to cpu_count * 5. + """ + + # urllib3 does not read proxy environment variables itself: + # https://github.com/urllib3/urllib3/issues/1785 + # A proxy taken from the environment is re-resolved when the host is + # assigned; see the host setter. + self._proxy_from_env = proxy is None + if proxy is None or no_proxy is None: + proxies = getproxies() + if proxy is None: + proxy = self._env_proxy(proxies, self.host) + if no_proxy is None: + no_proxy = proxies.get("no") + self._proxy = proxy + self.no_proxy = no_proxy + """Hosts that bypass the proxy + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.proxy_ssl_context = proxy_ssl_context + """SSL context used only for the TLS handshake with the proxy itself + (e.g. an HTTPS CONNECT tunnel), independent of the destination TLS + settings above. + """ + 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 == 'proxy_ssl_context': + # ssl.SSLContext holds unpicklable C state and can't be deepcopied. + setattr(result, k, v) + continue + 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 urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + 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 + if self._proxy_from_env: + # the scheme-specific proxy depends on the host, which is + # commonly assigned after construction + self._proxy = self._env_proxy(getproxies(), value) + + @staticmethod + def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]: + """Pick the environment proxy that applies to `host`.""" + return proxies.get(urlparse(host).scheme) or proxies.get("all") + + @property + def proxy(self) -> Optional[str]: + """Proxy URL + """ + return self._proxy + + @proxy.setter + def proxy(self, value: Optional[str]) -> None: + self._proxy = value + self._proxy_from_env = False diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py new file mode 100644 index 0000000..f5e8536 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py @@ -0,0 +1,218 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py new file mode 100644 index 0000000..8f51586 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +# flake8: noqa +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py new file mode 100644 index 0000000..6ceebd3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.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 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", alias="requestId") + target: Optional[StrictStr] = Field(default=None, description="url that has been called") + details: Optional[List[DetailsErrorResponse]] = None + __properties: ClassVar[List[str]] = ["code", "message", "requestId", "target", "details"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "requestId": obj.get("requestId"), + "target": obj.get("target"), + "details": [DetailsErrorResponse.from_dict(_item) for _item in obj["details"]] if obj.get("details") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py new file mode 100644 index 0000000..4eb04af --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.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.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 + __properties: ClassVar[List[str]] = ["chunks", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py new file mode 100644 index 0000000..1d26fb2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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] + __properties: ClassVar[List[str]] = ["id", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py new file mode 100644 index 0000000..5ab2c9f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py new file mode 100644 index 0000000..3bdd30b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py new file mode 100644 index 0000000..a77202a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +BATCHUPDATEDOCUMENTSRESPONSEINNER_ONE_OF_SCHEMAS = ["DocumentMetadataUpdate", "DocumentMetadataUpdateError"] + +class BatchUpdateDocumentsResponseInner(BaseModel): + """ + BatchUpdateDocumentsResponseInner + """ + # data type: DocumentMetadataUpdate + oneof_schema_1_validator: Optional[DocumentMetadataUpdate] = None + # data type: DocumentMetadataUpdateError + oneof_schema_2_validator: Optional[DocumentMetadataUpdateError] = None + actual_instance: Optional[Union[DocumentMetadataUpdate, DocumentMetadataUpdateError]] = None + one_of_schemas: Set[str] = { "DocumentMetadataUpdate", "DocumentMetadataUpdateError" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = BatchUpdateDocumentsResponseInner.model_construct() + error_messages = [] + match = 0 + # validate data type: DocumentMetadataUpdate + if not isinstance(v, DocumentMetadataUpdate): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdate`") + else: + match += 1 + # validate data type: DocumentMetadataUpdateError + if not isinstance(v, DocumentMetadataUpdateError): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdateError`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into DocumentMetadataUpdate + try: + instance.actual_instance = DocumentMetadataUpdate.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DocumentMetadataUpdateError + try: + instance.actual_instance = DocumentMetadataUpdateError.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DocumentMetadataUpdate, DocumentMetadataUpdateError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py new file mode 100644 index 0000000..c555e14 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +# TODO: Rewrite to not use raise_errors +BinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py new file mode 100644 index 0000000..681ac48 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class BoostingScoreComputationStrategy(str, Enum): + """ + BoostingScoreComputationStrategy + """ + + """ + allowed enum values + """ + MATCH_COUNT = 'match_count' + EMBEDDING = 'embedding' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BoostingScoreComputationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py new file mode 100644 index 0000000..8df4768 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.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, 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, alias="scoreComputationStrategy") + __properties: ClassVar[List[str]] = ["enabled", "metadata", "weight", "scoreComputationStrategy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoostingScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "metadata": [BoostingScoringConfigurationMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "weight": obj.get("weight") if "weight" in obj else 1, + "scoreComputationStrategy": obj.get("scoreComputationStrategy") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py new file mode 100644 index 0000000..3161a9d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py new file mode 100644 index 0000000..54de2ae --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py new file mode 100644 index 0000000..6deaa96 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.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 +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(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.") + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Collection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py new file mode 100644 index 0000000..153e5fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="collectionURL") + status: StrictStr + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCreatedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py new file mode 100644 index 0000000..09eb6c7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="collectionURL") + status: StrictStr + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionDeletedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py new file mode 100644 index 0000000..f9e2dd6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="monitorURL") + __properties: ClassVar[List[str]] = ["monitorURL"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionPendingResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "monitorURL": obj.get("monitorURL") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py new file mode 100644 index 0000000..8171e68 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.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 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(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.") + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py new file mode 100644 index 0000000..3f3642f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py new file mode 100644 index 0000000..4f0d01f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.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 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.", 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)", 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.") + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "type": obj.get("type"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py new file mode 100644 index 0000000..debda35 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.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 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.", 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)", alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + resource_uri: Optional[StrictStr] = Field(default=None, description="URI of the resource.", alias="resourceUri", json_schema_extra={"examples": ["https://example.com/resource/123"]}) + web_url: Optional[StrictStr] = Field(default=None, description="Web URL of the document.", alias="webUrl", json_schema_extra={"examples": ["https://example.com/web/123"]}) + document_etag: Optional[StrictStr] = Field(default=None, description="ETag of the document.", alias="documentEtag", json_schema_extra={"examples": ["abc123etag"]}) + file_suffix: Optional[StrictStr] = Field(default=None, description="File suffix of the document.", alias="fileSuffix", json_schema_extra={"examples": [".pdf"]}) + view_location: Optional[StrictStr] = Field(default=None, description="View location of the document.", alias="viewLocation", json_schema_extra={"examples": ["https://example.com/view/123"]}) + download_location: Optional[StrictStr] = Field(default=None, description="Download location of the document.", alias="downloadLocation", json_schema_extra={"examples": ["https://example.com/download/123"]}) + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) + file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) + metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "resourceUri", "webUrl", "documentEtag", "fileSuffix", "viewLocation", "downloadLocation", "mimeType", "fileSizeMb", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocumentFullDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "resourceUri": obj.get("resourceUri"), + "webUrl": obj.get("webUrl"), + "documentEtag": obj.get("documentEtag"), + "fileSuffix": obj.get("fileSuffix"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "mimeType": obj.get("mimeType"), + "fileSizeMb": obj.get("fileSizeMb"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py new file mode 100644 index 0000000..945e14a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py @@ -0,0 +1,224 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 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 + + # deserialize data into MSSharePointPipelineCreateRequest + try: + instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineCreateRequest + try: + instance.actual_instance = S3PipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineCreateRequest + try: + instance.actual_instance = SFTPPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineCreateRequest + try: + instance.actual_instance = SDMPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineCreateRequest + try: + instance.actual_instance = WorkZonePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineCreateRequest + try: + instance.actual_instance = ServiceNowPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineCreateRequest + try: + instance.actual_instance = GoogleDrivePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MetadataConfiguration + try: + instance.actual_instance = MetadataConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py new file mode 100644 index 0000000..7f7879d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py new file mode 100644 index 0000000..eeb0721 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.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, 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, alias="remoteGroundingName") + message: Optional[StrictStr] = None + type: DataRepositoryType + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepository from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "type": obj.get("type") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py new file mode 100644 index 0000000..936c513 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="filterId") + results: Optional[List[DataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py new file mode 100644 index 0000000..53364c7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="dataRepository") + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py new file mode 100644 index 0000000..3c82d1c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py new file mode 100644 index 0000000..a290173 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DataRepositoryType(str, Enum): + """ + Only include DataRepositories with the given type. + """ + + """ + allowed enum values + """ + VECTOR = 'vector' + HELP_DOT_SAP_DOT_COM = 'help.sap.com' + REMOTE_COLON_DG = 'remote:dg' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DataRepositoryType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py new file mode 100644 index 0000000..236cc92 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.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.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.", alias="remoteGroundingName") + message: Optional[StrictStr] = Field(default=None, description="Optional message.") + documents: List[Document] + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryWithDocuments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "documents": [Document.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py new file mode 100644 index 0000000..ed0a7b0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_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, 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.") + __properties: ClassVar[List[str]] = ["enabled", "weight"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py new file mode 100644 index 0000000..b67a2ac --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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") + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py new file mode 100644 index 0000000..eed09cd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.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, 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] + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py new file mode 100644 index 0000000..96845a6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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") + __properties: ClassVar[List[str]] = ["ids"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py new file mode 100644 index 0000000..5e988e4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.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, 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", alias="notFound") + __properties: ClassVar[List[str]] = ["deleted", "notFound"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deleted": obj.get("deleted"), + "notFound": obj.get("notFound") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py new file mode 100644 index 0000000..9e145c6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py new file mode 100644 index 0000000..91b7eaa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.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 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.") + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py new file mode 100644 index 0000000..baec5b9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py new file mode 100644 index 0000000..c667d40 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.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, 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).", alias="matchMode") + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + # set to None if match_mode (nullable) is None + # and model_fields_set contains the field + if self.match_mode is None and "match_mode" in self.model_fields_set: + _dict['matchMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py new file mode 100644 index 0000000..e0b920b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py new file mode 100644 index 0000000..2857009 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py new file mode 100644 index 0000000..a16114c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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."]}) + __properties: ClassVar[List[str]] = ["target", "code", "message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py new file mode 100644 index 0000000..38def6f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.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 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] + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py new file mode 100644 index 0000000..906c1dd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_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, 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.") + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py new file mode 100644 index 0000000..96120a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DocumentStatus(str, Enum): + """ + DocumentStatus + """ + + """ + allowed enum values + """ + TO_BE_PROCESSED = 'TO_BE_PROCESSED' + INDEXED = 'INDEXED' + REINDEXED = 'REINDEXED' + DEINDEXED = 'DEINDEXED' + FAILED = 'FAILED' + FAILED_TO_BE_RETRIED = 'FAILED_TO_BE_RETRIED' + TO_BE_SCHEDULED = 'TO_BE_SCHEDULED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DocumentStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py new file mode 100644 index 0000000..cd781a6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py new file mode 100644 index 0000000..ae54d7d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py new file mode 100644 index 0000000..a3d4d05 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py new file mode 100644 index 0000000..3b21551 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.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 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] + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py new file mode 100644 index 0000000..6675ab1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py new file mode 100644 index 0000000..930d167 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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 + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py new file mode 100644 index 0000000..fbb7033 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.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 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, alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsStatusResponseResourcesInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py new file mode 100644 index 0000000..4bbdbca --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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', alias="modelName") + __properties: ClassVar[List[str]] = ["modelName"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EmbeddingConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modelName": obj.get("modelName") if obj.get("modelName") is not None else 'text-embedding-ada-002' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py new file mode 100644 index 0000000..77098bd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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"]}) + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py new file mode 100644 index 0000000..35b332b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTER_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Filter(BaseModel): + """ + Advanced filter expression for combining metadata filters with boolean logic + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Filter.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py new file mode 100644 index 0000000..1e2216f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class FilterMatchModeEnum(str, Enum): + """ + FilterMatchModeEnum + """ + + """ + allowed enum values + """ + ANY = 'ANY' + ALL = 'ALL' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of FilterMatchModeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py new file mode 100644 index 0000000..caf9005 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTERSINNER_ANY_OF_SCHEMAS = ["RetrievalSearchFilter", "RetrievalVectorSearchFilter"] + +class FiltersInner(BaseModel): + """ + FiltersInner + """ + + # data type: RetrievalSearchFilter + anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + # data type: RetrievalVectorSearchFilter + anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalSearchFilter, RetrievalVectorSearchFilter]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalSearchFilter", "RetrievalVectorSearchFilter" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = FiltersInner.model_construct() + error_messages = [] + # validate data type: RetrievalSearchFilter + if not isinstance(v, RetrievalSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalSearchFilter`") + else: + return v + + # validate data type: RetrievalVectorSearchFilter + if not isinstance(v, RetrievalVectorSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalVectorSearchFilter`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + try: + instance.actual_instance = RetrievalSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + try: + instance.actual_instance = RetrievalVectorSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalSearchFilter, RetrievalVectorSearchFilter]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py new file mode 100644 index 0000000..c785ed2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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") + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py new file mode 100644 index 0000000..26e0f39 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 error + if self.error: + _dict['error'] = self.error.to_dict() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py new file mode 100644 index 0000000..3a90f73 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONCREATIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionCreatedResponse", "CollectionPendingResponse"] + +class GetCollectionCreationStatus200Response(BaseModel): + """ + GetCollectionCreationStatus200Response + """ + # data type: CollectionCreatedResponse + oneof_schema_1_validator: Optional[CollectionCreatedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionCreatedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionCreatedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionCreationStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionCreatedResponse + if not isinstance(v, CollectionCreatedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionCreatedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionCreatedResponse + try: + instance.actual_instance = CollectionCreatedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionCreatedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py new file mode 100644 index 0000000..8f248f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONDELETIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionDeletedResponse", "CollectionPendingResponse"] + +class GetCollectionDeletionStatus200Response(BaseModel): + """ + GetCollectionDeletionStatus200Response + """ + # data type: CollectionDeletedResponse + oneof_schema_1_validator: Optional[CollectionDeletedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionDeletedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionDeletedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionDeletionStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionDeletedResponse + if not isinstance(v, CollectionDeletedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionDeletedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionDeletedResponse + try: + instance.actual_instance = CollectionDeletedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionDeletedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py new file mode 100644 index 0000000..3cc9d36 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 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 + + # deserialize data into MSSharePointPipelineGetResponse + try: + instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineGetResponse + try: + instance.actual_instance = S3PipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineGetResponse + try: + instance.actual_instance = SFTPPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineGetResponse + try: + instance.actual_instance = SDMPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineGetResponse + try: + instance.actual_instance = WorkZonePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineGetResponse + try: + instance.actual_instance = ServiceNowPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineGetResponse + try: + instance.actual_instance = GoogleDrivePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py new file mode 100644 index 0000000..3bc1174 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_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 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, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[StrictStr] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + status: Optional[PipelineExecutionStatus] = None + __properties: ClassVar[List[str]] = ["id", "createdAt", "modifiedAt", "status"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineExecutionById from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py new file mode 100644 index 0000000..f03432e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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 + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py new file mode 100644 index 0000000..9c888bf --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="lastStarted", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + status: Optional[PipelineExecutionStatus] = None + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if last_completed_at (nullable) is None + # and model_fields_set contains the field + if self.last_completed_at is None and "last_completed_at" in self.model_fields_set: + _dict['lastCompletedAt'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "lastStarted": obj.get("lastStarted"), + "createdAt": obj.get("createdAt"), + "lastCompletedAt": obj.get("lastCompletedAt"), + "status": obj.get("status") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py new file mode 100644 index 0000000..5f126b1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py new file mode 100644 index 0000000..cb1ff0a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.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, 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(alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py new file mode 100644 index 0000000..0df1a95 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.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(alias="googleDrive") + __properties: ClassVar[List[str]] = ["googleDrive"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "googleDrive": GoogleDriveResourceDetail.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py new file mode 100644 index 0000000..762ffce --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.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 +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(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. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + metadata_config_id: Optional[StrictStr] = Field(default=None, alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "googleDrive", "cronExpression", "metadataConfigId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "googleDrive": GoogleDriveConfig.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "cronExpression": obj.get("cronExpression"), + "metadataConfigId": obj.get("metadataConfigId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py new file mode 100644 index 0000000..f02d223 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py new file mode 100644 index 0000000..c7106e4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py new file mode 100644 index 0000000..5ea5811 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py new file mode 100644 index 0000000..f3a1ac8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.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 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, alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py new file mode 100644 index 0000000..6df75c1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["detail"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py new file mode 100644 index 0000000..b10a0d6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.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, 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)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py new file mode 100644 index 0000000..ea2b183 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.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, 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.", alias="extractKeyWordsFromQuery") + __properties: ClassVar[List[str]] = ["enabled", "weight", "extractKeyWordsFromQuery"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + # set to None if extract_key_words_from_query (nullable) is None + # and model_fields_set contains the field + if self.extract_key_words_from_query is None and "extract_key_words_from_query" in self.model_fields_set: + _dict['extractKeyWordsFromQuery'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeyWordRetrievalScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "weight": obj.get("weight") if "weight" in obj else 1, + "extractKeyWordsFromQuery": obj.get("extractKeyWordsFromQuery") if "extractKeyWordsFromQuery" in obj else False + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py new file mode 100644 index 0000000..d6e6183 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Left(BaseModel): + """ + Left + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py new file mode 100644 index 0000000..81ae7aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Left1(BaseModel): + """ + Left operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py new file mode 100644 index 0000000..a823c9d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py new file mode 100644 index 0000000..4f8d627 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py new file mode 100644 index 0000000..8a2596d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py new file mode 100644 index 0000000..3d1fa35 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"] + +class LocationInner(BaseModel): + """ + LocationInner + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: int + anyof_schema_2_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LocationInner.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: int + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into int + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py new file mode 100644 index 0000000..dd4c0ed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + metadata_only: Optional[StrictBool] = Field(default=None, alias="metadataOnly", json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["pipelineId", "metadataOnly"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ManualPipelineTrigger from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId"), + "metadataOnly": obj.get("metadataOnly") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py new file mode 100644 index 0000000..9fc64a4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.", alias="includeAllMetaData") + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if model (nullable) is None + # and model_fields_set contains the field + if self.model is None and "model" in self.model_fields_set: + _dict['model'] = None + + # set to None if boosting (nullable) is None + # and model_fields_set contains the field + if self.boosting is None and "boosting" in self.model_fields_set: + _dict['boosting'] = None + + # set to None if include_all_meta_data (nullable) is None + # and model_fields_set contains the field + if self.include_all_meta_data is None and "include_all_meta_data" in self.model_fields_set: + _dict['includeAllMetaData'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyReranker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "model": obj.get("model") if "model" in obj else 'cohere-3.5', + "boosting": [MergeStrategyRerankerBoostingInner.from_dict(_item) for _item in obj["boosting"]] if obj.get("boosting") is not None else None, + "includeAllMetaData": obj.get("includeAllMetaData") if "includeAllMetaData" in obj else False + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py new file mode 100644 index 0000000..be3cf90 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.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, 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.") + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py new file mode 100644 index 0000000..36716f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py new file mode 100644 index 0000000..85e49ed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MergeStrategyType(str, Enum): + """ + MergeStrategyType + """ + + """ + allowed enum values + """ + RERANKER = 'reranker' + SCOREREUSE = 'scoreReuse' + RECIPROCALRANKFUSION = 'reciprocalRankFusion' + RANDOM = 'random' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MergeStrategyType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py new file mode 100644 index 0000000..6e46486 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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"]}) + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py new file mode 100644 index 0000000..ac391ef --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.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.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py new file mode 100644 index 0000000..bd4d035 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.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, 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)] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py new file mode 100644 index 0000000..e20d10b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.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 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py new file mode 100644 index 0000000..d3e13d0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MetadataConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetadataConfigurationMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py new file mode 100644 index 0000000..3336019 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataKeyValuePairStrict.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py new file mode 100644 index 0000000..b1995ec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_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, 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 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.", alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py new file mode 100644 index 0000000..4dd5ae4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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"]}) + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py new file mode 100644 index 0000000..a67dc66 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.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, 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 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.", alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, 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.", alias="enumerationStatus") + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if enumeration_status (nullable) is None + # and model_fields_set contains the field + if self.enumeration_status is None and "enumeration_status" in self.model_fields_set: + _dict['enumerationStatus'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None, + "enumerationStatus": obj.get("enumerationStatus") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py new file mode 100644 index 0000000..804545f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.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_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(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. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py new file mode 100644 index 0000000..ddf54f0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.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, 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") + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py new file mode 100644 index 0000000..7eb14ab --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.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, 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") + __properties: ClassVar[List[str]] = ["key", "operations"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py new file mode 100644 index 0000000..0009ddd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["op", "values"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py new file mode 100644 index 0000000..ef99f22 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MetadataOperationEnum(str, Enum): + """ + MetadataOperationEnum + """ + + """ + allowed enum values + """ + ADD = 'add' + REMOVE = 'remove' + REPLACE = 'replace' + DELETE_KEY = 'delete_key' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MetadataOperationEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py new file mode 100644 index 0000000..27b82ad --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_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 +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.") + __properties: ClassVar[List[str]] = ["current_metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py new file mode 100644 index 0000000..55edd56 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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", alias="metadataUpdates") + __properties: ClassVar[List[str]] = ["ids", "metadataUpdates"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataUpdateItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "metadataUpdates": [MetadataKeyUpdate.from_dict(_item) for _item in obj["metadataUpdates"]] if obj.get("metadataUpdates") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py new file mode 100644 index 0000000..b33bc4e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["updates"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py new file mode 100644 index 0000000..aaa86e4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.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.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(alias="sharePoint") + cron_expression: Optional[StrictStr] = Field(default=None, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sharePoint", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfig.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py new file mode 100644 index 0000000..953bd0b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="sharePoint") + __properties: ClassVar[List[str]] = ["destination", "sharePoint"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfigGetResponse.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py new file mode 100644 index 0000000..5676fa5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="sharePoint") + __properties: ClassVar[List[str]] = ["sharePoint"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sharePoint": SharePointSiteDetail.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py new file mode 100644 index 0000000..a05ca76 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MSSharePointConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py new file mode 100644 index 0000000..66df4f4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py new file mode 100644 index 0000000..853bd3f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py new file mode 100644 index 0000000..3eab15d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["metadata", "configuration"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py new file mode 100644 index 0000000..5117e86 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + __properties: ClassVar[List[str]] = ["cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cronExpression": obj.get("cronExpression") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py new file mode 100644 index 0000000..e9fdd7d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py new file mode 100644 index 0000000..90f1518 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="filterId") + results: List[DocumentsChunk] + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py new file mode 100644 index 0000000..7d52ede --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py new file mode 100644 index 0000000..8fee675 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="filterId") + error: Optional[PerFilterSearchResultError] = None + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": PerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py new file mode 100644 index 0000000..9bc1b3b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.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 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, alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineDocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py new file mode 100644 index 0000000..f882e16 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if modified_at (nullable) is None + # and model_fields_set contains the field + if self.modified_at is None and "modified_at" in self.model_fields_set: + _dict['modifiedAt'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineExecutionData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py new file mode 100644 index 0000000..1b7eae7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class PipelineExecutionStatus(str, Enum): + """ + PipelineExecutionStatus + """ + + """ + allowed enum values + """ + NEW = 'NEW' + CREATING = 'CREATING' + CREATED = 'CREATED' + CREATION_FAILED = 'CREATION_FAILED' + UNKNOWN = 'UNKNOWN' + INPROGRESS = 'INPROGRESS' + FINISHED = 'FINISHED' + FINISHEDWITHERRORS = 'FINISHEDWITHERRORS' + TIMEOUT = 'TIMEOUT' + DELETION_INPROGRESS = 'DELETION_INPROGRESS' + DELETION_FAILED = 'DELETION_FAILED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PipelineExecutionStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py new file mode 100644 index 0000000..d5778d9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + __properties: ClassVar[List[str]] = ["pipelineId"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py new file mode 100644 index 0000000..da6363a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 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 + + # deserialize data into MSSharePointPipelineMinimalResponse + try: + instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineMinimalResponse + try: + instance.actual_instance = S3PipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineMinimalResponse + try: + instance.actual_instance = SFTPPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineMinimalResponse + try: + instance.actual_instance = SDMPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineMinimalResponse + try: + instance.actual_instance = WorkZonePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineMinimalResponse + try: + instance.actual_instance = ServiceNowPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineMinimalResponse + try: + instance.actual_instance = GoogleDrivePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py new file mode 100644 index 0000000..ff77906 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.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, 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.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py new file mode 100644 index 0000000..a7c51da --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.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, 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.", alias="maxChunkCount") + strategy: Strategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostProcessingOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": Strategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +# TODO: Rewrite to not use raise_errors +PostProcessingOperation.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py new file mode 100644 index 0000000..fb68357 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER_ANY_OF_SCHEMAS = ["PerFilterSearchResult"] + +class ResultsInner(BaseModel): + """ + ResultsInner + """ + + # data type: PerFilterSearchResult + anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[PerFilterSearchResult]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "PerFilterSearchResult" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner.model_construct() + error_messages = [] + # validate data type: PerFilterSearchResult + if not isinstance(v, PerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResult`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + try: + instance.actual_instance = PerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PerFilterSearchResult]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py new file mode 100644 index 0000000..68e9338 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER1_ANY_OF_SCHEMAS = ["RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError"] + +class ResultsInner1(BaseModel): + """ + ResultsInner1 + """ + + # data type: RetrievalPerFilterSearchResult + anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + # data type: RetrievalPerFilterSearchResultWithError + anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner1.model_construct() + error_messages = [] + # validate data type: RetrievalPerFilterSearchResult + if not isinstance(v, RetrievalPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResult`") + else: + return v + + # validate data type: RetrievalPerFilterSearchResultWithError + if not isinstance(v, RetrievalPerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py new file mode 100644 index 0000000..fad5461 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER2_ANY_OF_SCHEMAS = ["DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError"] + +class ResultsInner2(BaseModel): + """ + ResultsInner2 + """ + + # data type: DataRepositoryPerFilterSearchResult + anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + # data type: PerFilterSearchResultWithError + anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner2.model_construct() + error_messages = [] + # validate data type: DataRepositoryPerFilterSearchResult + if not isinstance(v, DataRepositoryPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `DataRepositoryPerFilterSearchResult`") + else: + return v + + # validate data type: PerFilterSearchResultWithError + if not isinstance(v, PerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + try: + instance.actual_instance = DataRepositoryPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + try: + instance.actual_instance = PerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py new file mode 100644 index 0000000..798a6c6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +# TODO: Rewrite to not use raise_errors +RetrievalBinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py new file mode 100644 index 0000000..2c4a64f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_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, 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, alias="searchScores") + post_processing_score: Optional[Score] = Field(default=None, alias="postProcessingScore") + __properties: ClassVar[List[str]] = ["id", "content", "metadata", "searchScores", "postProcessingScore"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "searchScores": SearchScores.from_dict(obj["searchScores"]) if obj.get("searchScores") is not None else None, + "postProcessingScore": Score.from_dict(obj["postProcessingScore"]) if obj.get("postProcessingScore") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py new file mode 100644 index 0000000..a6deb47 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="dataRepository") + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py new file mode 100644 index 0000000..14f64d4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py new file mode 100644 index 0000000..ec2cb08 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.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, 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)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py new file mode 100644 index 0000000..46a27ab --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_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, 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(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.", alias="remoteGroundingName") + __properties: ClassVar[List[str]] = ["filterId", "results", "remoteGroundingName"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [RetrievalDataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py new file mode 100644 index 0000000..f2ca28a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py new file mode 100644 index 0000000..e5cc642 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="filterId") + error: Optional[RetrievalPerFilterSearchResultError] = None + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": RetrievalPerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py new file mode 100644 index 0000000..4873581 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_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, 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' + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py new file mode 100644 index 0000000..492b770 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.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 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'.", 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.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py new file mode 100644 index 0000000..759ceb2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py new file mode 100644 index 0000000..f7c45cb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.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 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, 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.", alias="dataRepositories") + data_repository_type: DataRepositoryType = Field(alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", 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=['*']", alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py new file mode 100644 index 0000000..8590818 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.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 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.", alias="postProcessing") + __properties: ClassVar[List[str]] = ["query", "filters", "postProcessing"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if query (nullable) is None + # and model_fields_set contains the field + if self.query is None and "query" in self.model_fields_set: + _dict['query'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": [FiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, + "postProcessing": [RetrievalSearchInputPostProcessingInner.from_dict(_item) for _item in obj["postProcessing"]] if obj.get("postProcessing") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py new file mode 100644 index 0000000..b129576 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.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 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.", alias="maxChunkCount") + strategy: RetrievalSearchInputPostProcessingInnerStrategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInputPostProcessingInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": RetrievalSearchInputPostProcessingInnerStrategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py new file mode 100644 index 0000000..1383487 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERINPUTSINNER_ONE_OF_SCHEMAS = ["PostProcessingObjectReference", "PostProcessingOperation"] + +class RetrievalSearchInputPostProcessingInnerInputsInner(BaseModel): + """ + RetrievalSearchInputPostProcessingInnerInputsInner + """ + # data type: PostProcessingObjectReference + oneof_schema_1_validator: Optional[PostProcessingObjectReference] = None + # data type: PostProcessingOperation + oneof_schema_2_validator: Optional[PostProcessingOperation] = None + actual_instance: Optional[Union[PostProcessingObjectReference, PostProcessingOperation]] = None + one_of_schemas: Set[str] = { "PostProcessingObjectReference", "PostProcessingOperation" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerInputsInner.model_construct() + error_messages = [] + match = 0 + # validate data type: PostProcessingObjectReference + if not isinstance(v, PostProcessingObjectReference): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingObjectReference`") + else: + match += 1 + # validate data type: PostProcessingOperation + if not isinstance(v, PostProcessingOperation): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingOperation`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into PostProcessingObjectReference + try: + instance.actual_instance = PostProcessingObjectReference.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PostProcessingOperation + try: + instance.actual_instance = PostProcessingOperation.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PostProcessingObjectReference, PostProcessingOperation]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +# TODO: Rewrite to not use raise_errors +RetrievalSearchInputPostProcessingInnerInputsInner.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py new file mode 100644 index 0000000..61c1879 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERSTRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class RetrievalSearchInputPostProcessingInnerStrategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerStrategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py new file mode 100644 index 0000000..ce50ad3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py new file mode 100644 index 0000000..31e9eea --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RetrievalSearchSelectOptionEnum(str, Enum): + """ + RetrievalSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RetrievalSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py new file mode 100644 index 0000000..4e53a26 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, 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.", alias="dataRepositories") + data_repository_type: Optional[DataRepositoryType] = Field(default=None, alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", 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=['*']", alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + filter: Optional[RetrievalVectorSearchFilterFilter] = None + scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, alias="scoringConfiguration") + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata", "filter", "scoringConfiguration"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalVectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": RetrievalVectorSearchFilterFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "scoringConfiguration": VectorScoringConfiguration.from_dict(obj["scoringConfiguration"]) if obj.get("scoringConfiguration") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py new file mode 100644 index 0000000..3ea17cc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RETRIEVALVECTORSEARCHFILTERFILTER_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class RetrievalVectorSearchFilterFilter(BaseModel): + """ + Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = RetrievalVectorSearchFilterFilter.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py new file mode 100644 index 0000000..4e268a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Right(BaseModel): + """ + Right + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py new file mode 100644 index 0000000..10277c5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Right1(BaseModel): + """ + Right operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py new file mode 100644 index 0000000..25cac46 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.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.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, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "s3", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3Configuration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3Configuration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py new file mode 100644 index 0000000..09b78d6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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.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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py new file mode 100644 index 0000000..a76250a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py new file mode 100644 index 0000000..0575e4f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py new file mode 100644 index 0000000..03f9cb9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py new file mode 100644 index 0000000..ae037ec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_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, 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)") + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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' + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py new file mode 100644 index 0000000..dbb8398 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py new file mode 100644 index 0000000..a566813 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoresAggregationStrategy(str, Enum): + """ + ScoresAggregationStrategy + """ + + """ + allowed enum values + """ + WEIGHTED_AVERAGE = 'weighted_average' + RRF = 'rrf' + WEIGHTED_RRF = 'weighted_rrf' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoresAggregationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py new file mode 100644 index 0000000..e1d74c6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py new file mode 100644 index 0000000..b641852 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py new file mode 100644 index 0000000..578e118 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py new file mode 100644 index 0000000..a909b07 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.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 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'.", 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.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py new file mode 100644 index 0000000..2401197 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py new file mode 100644 index 0000000..5c4583c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.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 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(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=['*']", 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.", 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.", alias="chunkMetadata") + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": SearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [SearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py new file mode 100644 index 0000000..ed1e069 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.", alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchPipeline from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py new file mode 100644 index 0000000..e953ba6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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] + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py new file mode 100644 index 0000000..8b6d6f8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py new file mode 100644 index 0000000..994a233 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="aggregatedScore") + dense_retrieval_score: SearchScoresAggregatedScore = Field(alias="denseRetrievalScore") + __properties: ClassVar[List[str]] = ["aggregatedScore", "denseRetrievalScore"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchScores from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aggregatedScore": SearchScoresAggregatedScore.from_dict(obj["aggregatedScore"]) if obj.get("aggregatedScore") is not None else None, + "denseRetrievalScore": SearchScoresAggregatedScore.from_dict(obj["denseRetrievalScore"]) if obj.get("denseRetrievalScore") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py new file mode 100644 index 0000000..01e55eb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py new file mode 100644 index 0000000..170a28a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SearchSelectOptionEnum(str, Enum): + """ + SearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py new file mode 100644 index 0000000..0b8f732 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.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_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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py new file mode 100644 index 0000000..7b9e725 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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 ServiceNowConfigurationMinimal(BaseModel): + """ + ServiceNowConfigurationMinimal + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + service_now: Optional[ServiceNowConfigurationMinimalServiceNow] = Field(default=None, alias="serviceNow") + __properties: ClassVar[List[str]] = ["destination", "serviceNow"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py new file mode 100644 index 0000000..d9861f7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + __properties: ClassVar[List[str]] = ["includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimalServiceNow from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py new file mode 100644 index 0000000..1ef22c8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.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 +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, alias="serviceNow") + metadata_config_id: Optional[StrictStr] = Field(default=None, 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. ", alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "serviceNow", "metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfig.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None, + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py new file mode 100644 index 0000000..a586f44 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": ServiceNowConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py new file mode 100644 index 0000000..543113c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py new file mode 100644 index 0000000..f2c7070 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py new file mode 100644 index 0000000..0d32c5e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.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.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, alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sftp", "cronExpression"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py new file mode 100644 index 0000000..2150c85 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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.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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py new file mode 100644 index 0000000..cada661 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py new file mode 100644 index 0000000..bc04e53 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py new file mode 100644 index 0000000..25436e3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py new file mode 100644 index 0000000..d145dcb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.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 +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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of site + if self.site: + _dict['site'] = self.site.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "site": SharePointSite.from_dict(obj["site"]) if obj.get("site") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py new file mode 100644 index 0000000..809b82d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["site"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 site + if self.site: + _dict['site'] = self.site.to_dict() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py new file mode 100644 index 0000000..1ee43f6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.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 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, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSite from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py new file mode 100644 index 0000000..afc908a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py new file mode 100644 index 0000000..b4ff0d7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="includePaths") + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py new file mode 100644 index 0000000..75abb5f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +STRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class Strategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = Strategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py new file mode 100644 index 0000000..676e490 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.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 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.") + __properties: ClassVar[List[str]] = ["content", "metadata", "id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py new file mode 100644 index 0000000..4a39149 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py new file mode 100644 index 0000000..fd74b28 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.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, 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] + __properties: ClassVar[List[str]] = ["query", "filters"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py new file mode 100644 index 0000000..11fb83a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.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.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 + __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py new file mode 100644 index 0000000..abb8ac4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do 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 + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py new file mode 100644 index 0000000..26de54e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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, alias="matchMode") + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py new file mode 100644 index 0000000..cecb792 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.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, 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)]] + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py new file mode 100644 index 0000000..796a898 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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(alias="filterId") + results: List[DocumentsChunk] + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py new file mode 100644 index 0000000..cd8969b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.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, 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, alias="denseRetrieval") + keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = Field(default=None, alias="keywordRetrieval") + boosting: Optional[BoostingScoringConfiguration] = None + score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", alias="scoreThreshold") + aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, alias="aggregationStrategy") + __properties: ClassVar[List[str]] = ["denseRetrieval", "keywordRetrieval", "boosting", "scoreThreshold", "aggregationStrategy"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + # set to None if score_threshold (nullable) is None + # and model_fields_set contains the field + if self.score_threshold is None and "score_threshold" in self.model_fields_set: + _dict['scoreThreshold'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "denseRetrieval": DenseRetrievalScoringConfiguration.from_dict(obj["denseRetrieval"]) if obj.get("denseRetrieval") is not None else None, + "keywordRetrieval": KeyWordRetrievalScoringConfiguration.from_dict(obj["keywordRetrieval"]) if obj.get("keywordRetrieval") is not None else None, + "boosting": BoostingScoringConfiguration.from_dict(obj["boosting"]) if obj.get("boosting") is not None else None, + "scoreThreshold": obj.get("scoreThreshold"), + "aggregationStrategy": obj.get("aggregationStrategy") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py new file mode 100644 index 0000000..9f7f7b8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.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 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'.", 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.", alias="maxDocumentCount") + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py new file mode 100644 index 0000000..6e902c3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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", alias="selectMode") + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py new file mode 100644 index 0000000..d2c1db4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.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 +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(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=['*']", alias="collectionMetadata") + document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", alias="documentMetadata") + chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", alias="chunkMetadata") + filter: Optional[Filter] = None + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata", "filter"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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() + # set to None if collection_metadata (nullable) is None + # and model_fields_set contains the field + if self.collection_metadata is None and "collection_metadata" in self.model_fields_set: + _dict['collectionMetadata'] = None + + # set to None if document_metadata (nullable) is None + # and model_fields_set contains the field + if self.document_metadata is None and "document_metadata" in self.model_fields_set: + _dict['documentMetadata'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": VectorSearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [VectorSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": Filter.from_dict(obj["filter"]) if obj.get("filter") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py new file mode 100644 index 0000000..eba6526 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not 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.") + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 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 + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py new file mode 100644 index 0000000..98754a0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class VectorSearchSelectOptionEnum(str, Enum): + """ + VectorSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of VectorSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py new file mode 100644 index 0000000..c05c956 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.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, 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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py new file mode 100644 index 0000000..75b30a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_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, 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 + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + 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 + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py new file mode 100644 index 0000000..2bfdb09 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_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, 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]}) + __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( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # 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") + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed b/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py new file mode 100644 index 0000000..052a4b8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The 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 ipaddress +import io +import json +import re +import ssl +from urllib.parse import urlparse + +import urllib3 + +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + +def contenttype_matches(contenttype, maintype, subtype): + """Matches the given contenttype against the given type and subtype + + :param contenttype: the content type to match + :param maintype: the expected maintype + :param subtype: the expected subtype + :return: `true` when the given content type matches the given type and subtype, + regardless of the presence of mime type parameters, otherwise returns `false`. + :rtype: bool + """ + pattern = '{type}/(?:[^+;]+\\+)?{subtype}(?:[ \t]*;.*)?'.format( + type = re.escape(maintype), + subtype = re.escape(subtype), + ) + return re.fullmatch(pattern, contenttype, re.IGNORECASE) is not None + +def should_bypass_proxies(url: str, no_proxy: str) -> bool: + """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" + parsed_url = urlparse(url) + if not parsed_url.hostname: + return True + + host = parsed_url.hostname.lower() + host_and_port = parsed_url.netloc.lower() + try: + host_ip = ipaddress.ip_address(host) + except ValueError: + host_ip = None + + for entry in (entry.strip().lower() for entry in no_proxy.split(',')): + if not entry: + continue + if entry == '*': + return True + + if host_ip is not None: + try: + if host_ip in ipaddress.ip_network(entry, strict=False): + return True + except ValueError: + pass + + entry = entry.lstrip('.') + if ( + host == entry + or host.endswith('.' + entry) + or host_and_port == entry + or host_and_port.endswith('.' + entry) + ): + return True + + return False + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a dictionary of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers.get()`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy and not should_bypass_proxies( + configuration.host, configuration.no_proxy or '' + ): + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + if configuration.proxy_ssl_context is not None: + pool_args["proxy_ssl_context"] = configuration.proxy_ssl_context + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :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 = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + content_type = headers.get('Content-Type') + is_json = ( + not content_type + or contenttype_matches(content_type, 'application', 'json') + ) + # JSON is valid YAML 1.2, so structured YAML bodies can use + # the existing JSON serializer: + # https://yaml.org/spec/1.2.2/#13-relation-to-json + is_structured_yaml = ( + content_type + and ( + contenttype_matches(content_type, 'application', 'yaml') + or contenttype_matches(content_type, 'text', 'yaml') + or contenttype_matches(content_type, 'text', 'x-yaml') + ) + and not isinstance(body, (str, bytes)) + ) + if is_json or is_structured_yaml: + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'): + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif contenttype_matches(content_type, 'multipart', 'form-data'): + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` 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): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type.startswith('text/') and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + 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) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/packages/openapi-generator/Makefile b/packages/openapi-generator/Makefile new file mode 100644 index 0000000..89f28eb --- /dev/null +++ b/packages/openapi-generator/Makefile @@ -0,0 +1,41 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPEC_DIR := $(PKG_DIR)specs/document-grounding +OPTIONS_FILE := $(SPEC_DIR)/options-per-service.json +SPEC_KEY := src/spec/api.yaml +SPEC_INPUT := $(SPEC_DIR)/api.yaml +PROCESSED := $(PKG_DIR).cache/processed.yaml +MAPPINGS := $(PKG_DIR).cache/mappings.yaml +GEN_TMP := $(PKG_DIR).cache/gen-tmp +GEN_OUT := $(PKG_DIR)../../gen/gen_ai_hub/document_grounding_generation/generated +CONFIG := $(PKG_DIR)config/python-config.yaml +# Fully-qualified import prefix used inside the generated files after rewriting +GEN_PKG := gen_ai_hub.document_grounding_generation.generated + +.PHONY: generate test + +generate: + mkdir -p $(PKG_DIR).cache + uv run --package sap-openapi-generator python -m sap_openapi_generator.preprocess_spec \ + --input $(SPEC_INPUT) \ + --output $(PROCESSED) \ + --options $(OPTIONS_FILE) \ + --spec-key "$(SPEC_KEY)" \ + --mappings-output $(MAPPINGS) + npx --yes @openapitools/openapi-generator-cli generate \ + -g python \ + -i $(PROCESSED) \ + -o $(GEN_TMP) \ + -c $(CONFIG) \ + $$([ -f $(MAPPINGS) ] && echo "--config $(MAPPINGS)") \ + --additional-properties packageName=generated + rm -rf $(GEN_OUT) + mv $(GEN_TMP)/generated $(GEN_OUT) + rm -rf $(GEN_TMP) $(PROCESSED) $(MAPPINGS) + # Rewrite bare 'generated' imports to fully-qualified package path + find $(GEN_OUT) -name "*.py" -exec \ + sed -i '' \ + 's/from generated\./from $(GEN_PKG)./g; s/import generated\./import $(GEN_PKG)./g; s/from generated import /from $(GEN_PKG) import /g' \ + {} + + +test: + uv run --package sap-openapi-generator pytest $(PKG_DIR)tests/ -v diff --git a/packages/openapi-generator/config/openapitools.json b/packages/openapi-generator/config/openapitools.json new file mode 100644 index 0000000..b11fef7 --- /dev/null +++ b/packages/openapi-generator/config/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.8.0" + } +} diff --git a/packages/openapi-generator/config/python-config.yaml b/packages/openapi-generator/config/python-config.yaml new file mode 100644 index 0000000..39f2dc8 --- /dev/null +++ b/packages/openapi-generator/config/python-config.yaml @@ -0,0 +1,43 @@ +# 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 + +# Override at call site with --additional-properties packageName= +packageName: generated_client +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 + +# 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/openapitools.json b/packages/openapi-generator/openapitools.json new file mode 100644 index 0000000..8dd0d74 --- /dev/null +++ b/packages/openapi-generator/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/openapi-generator/pyproject.toml b/packages/openapi-generator/pyproject.toml new file mode 100644 index 0000000..3969539 --- /dev/null +++ b/packages/openapi-generator/pyproject.toml @@ -0,0 +1,30 @@ +[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" + +[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/specs/document-grounding/api.yaml b/packages/openapi-generator/specs/document-grounding/api.yaml new file mode 100644 index 0000000..44d2846 --- /dev/null +++ b/packages/openapi-generator/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/openapi-generator/specs/document-grounding/options-per-service.json b/packages/openapi-generator/specs/document-grounding/options-per-service.json new file mode 100644 index 0000000..b233246 --- /dev/null +++ b/packages/openapi-generator/specs/document-grounding/options-per-service.json @@ -0,0 +1,7 @@ +{ + "src/spec/api.yaml": { + "packageName": "document_grounding", + "directoryName": "document_grounding", + "basePath": "/lm/document-grounding" + } +} diff --git a/packages/openapi-generator/src/sap_openapi_generator/__init__.py b/packages/openapi-generator/src/sap_openapi_generator/__init__.py new file mode 100644 index 0000000..83f8e9c --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/__init__.py @@ -0,0 +1 @@ +"""SAP OpenAPI Generator package.""" diff --git a/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py new file mode 100644 index 0000000..decbb48 --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py @@ -0,0 +1,230 @@ +"""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 share the same desired name (valid in JS since they live in + different API classes), disambiguates by prefixing with the operation's tag: + e.g. both want "search" → "vector_search" and "retrieval_search" + + Returns an operationIdNameMappings dict (may be empty) that the generator config + should merge in, mapping the scoped operationId back to the desired method name. + """ + # 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 and mappings_output_path: + mappings_output_path.parent.mkdir(parents=True, exist_ok=True) + with mappings_output_path.open("w") as f: + yaml.dump({"operationIdNameMappings": mappings}, f, sort_keys=True) + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Pre-process an OpenAPI spec to apply SAP Cloud SDK vendor extensions." + ) + parser.add_argument("--input", required=True, type=Path, help="Source spec file (.yaml or .json)") + parser.add_argument("--output", required=True, type=Path, help="Output path for processed spec") + parser.add_argument( + "--options", + type=Path, + default=None, + help="Path to options-per-service.json (JS SDK format)", + ) + parser.add_argument( + "--spec-key", + default=None, + help="Key in options-per-service.json selecting this spec's options (e.g. 'src/spec/api.yaml')", + ) + parser.add_argument( + "--mappings-output", + type=Path, + default=None, + help="Optional path to write operationIdNameMappings YAML fragment (for --config merging)", + ) + args = parser.parse_args() + preprocess(args.input, args.output, args.options, args.spec_key, args.mappings_output) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/tests/test_preprocess_spec.py b/packages/openapi-generator/tests/test_preprocess_spec.py new file mode 100644 index 0000000..1686704 --- /dev/null +++ b/packages/openapi-generator/tests/test_preprocess_spec.py @@ -0,0 +1,352 @@ +"""Unit tests for sap_openapi_generator.preprocess_spec.""" + +from __future__ import annotations + +import json +import pytest +from pathlib import Path + +from sap_openapi_generator.preprocess_spec import ( + apply_api_name_extension, + apply_operation_name_extension, + apply_options_per_service, + strip_api_suffix, + validate_unique_operation_ids, + _snake_case, +) + + +# --------------------------------------------------------------------------- +# strip_api_suffix +# --------------------------------------------------------------------------- + + +def test_strip_api_suffix_removes_trailing_Api(): + assert strip_api_suffix("FooApi") == "Foo" + + +def test_strip_api_suffix_case_sensitive_uppercase_unchanged(): + # Only literal "Api" is stripped — "API" is not (matches Java behavior) + assert strip_api_suffix("FooAPI") == "FooAPI" + + +def test_strip_api_suffix_not_at_end(): + assert strip_api_suffix("MyApiService") == "MyApiService" + + +def test_strip_api_suffix_only_api(): + # Edge case: name IS "Api" → empty string + assert strip_api_suffix("Api") == "" + + +def test_strip_api_suffix_no_suffix(): + assert strip_api_suffix("Foo") == "Foo" + + +# --------------------------------------------------------------------------- +# apply_api_name_extension +# --------------------------------------------------------------------------- + + +def _op(**kwargs) -> dict: + op: dict = {"operationId": "defaultOp", "responses": {"200": {"description": "ok"}}} + op.update(kwargs) + return op + + +def test_api_name_root_level_applied_to_all_operations(): + spec = { + "x-sap-cloud-sdk-api-name": "SodasApi", + "paths": { + "/sodas": {"get": _op(operationId="listSodas")}, + "/sodas/{id}": {"get": _op(operationId="getSoda")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/sodas"]["get"]["tags"] == ["Sodas"] + assert spec["paths"]["/sodas/{id}"]["get"]["tags"] == ["Sodas"] + + +def test_api_name_path_level_overrides_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA"), + }, + "/b": {"get": _op(operationId="opB")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Path"] + assert spec["paths"]["/b"]["get"]["tags"] == ["Root"] + + +def test_api_name_operation_level_overrides_path_and_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA", **{"x-sap-cloud-sdk-api-name": "OperationApi"}), + }, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Operation"] + + +def test_api_name_no_extension_preserves_existing_tags(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["existing"], "responses": {}}}, + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["existing"] + + +def test_api_name_multiple_methods_on_same_path(): + spec = { + "paths": { + "/items": { + "x-sap-cloud-sdk-api-name": "ItemsApi", + "get": _op(operationId="listItems"), + "post": _op(operationId="createItem"), + } + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/items"]["get"]["tags"] == ["Items"] + assert spec["paths"]["/items"]["post"]["tags"] == ["Items"] + + +def test_api_name_non_http_method_keys_ignored(): + spec = { + "x-sap-cloud-sdk-api-name": "FooApi", + "paths": { + "/a": { + "parameters": [{"name": "id", "in": "path"}], + "get": _op(operationId="getA"), + } + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Foo"] + assert isinstance(spec["paths"]["/a"]["parameters"], list) + + +def test_api_name_empty_paths_does_not_crash(): + apply_api_name_extension({"paths": {}}) + + +def test_api_name_no_paths_key_does_not_crash(): + apply_api_name_extension({}) + + +# --------------------------------------------------------------------------- +# apply_operation_name_extension +# --------------------------------------------------------------------------- + + +def test_operation_name_overwrites_operation_id(): + spec = { + "paths": { + "/pets/{id}": { + "get": { + "operationId": "getPetById", + "tags": ["Pets"], + "x-sap-cloud-sdk-operation-name": "fetchPet", + "responses": {}, + } + } + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/pets/{id}"]["get"]["operationId"] == "fetchPet" + assert mappings == {} + + +def test_operation_name_absent_leaves_operation_id_unchanged(): + spec = {"paths": {"/pets": {"get": {"operationId": "listPets", "responses": {}}}}} + apply_operation_name_extension(spec) + assert spec["paths"]["/pets"]["get"]["operationId"] == "listPets" + + +def test_operation_name_no_paths_key_does_not_crash(): + apply_operation_name_extension({}) + + +def test_operation_name_disambiguates_cross_tag_collision(): + """Two operations in different tags both want 'search' — must be scoped.""" + spec = { + "paths": { + "/vector/search": { + "post": { + "operationId": "vector.search_chunk", + "tags": ["Vector"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + "/retrieval/search": { + "post": { + "operationId": "retrieval.search", + "tags": ["Retrieval"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/vector/search"]["post"]["operationId"] == "vector_search" + assert spec["paths"]["/retrieval/search"]["post"]["operationId"] == "retrieval_search" + assert mappings == {"vector_search": "search", "retrieval_search": "search"} + + +def test_operation_name_no_collision_no_mappings(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["A"], + "x-sap-cloud-sdk-operation-name": "getA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "tags": ["B"], + "x-sap-cloud-sdk-operation-name": "getB", "responses": {}}}, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/a"]["get"]["operationId"] == "getA" + assert spec["paths"]["/b"]["get"]["operationId"] == "getB" + assert mappings == {} + + +# --------------------------------------------------------------------------- +# _snake_case +# --------------------------------------------------------------------------- + + +def test_snake_case_camel(): + assert _snake_case("camelCase") == "camel_case" + + +def test_snake_case_pascal(): + assert _snake_case("PascalCase") == "pascal_case" + + +def test_snake_case_already_snake(): + assert _snake_case("already_snake") == "already_snake" + + +# --------------------------------------------------------------------------- +# Both extensions applied together +# --------------------------------------------------------------------------- + + +def test_both_extensions_applied_independently(): + spec = { + "paths": { + "/drinks/{id}": { + "get": { + "operationId": "getDrinkById", + "x-sap-cloud-sdk-api-name": "DrinksApi", + "x-sap-cloud-sdk-operation-name": "fetchDrink", + "responses": {}, + } + } + } + } + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + op = spec["paths"]["/drinks/{id}"]["get"] + assert op["tags"] == ["Drinks"] + assert op["operationId"] == "fetchDrink" + +def test_no_extension_is_a_passthrough(): + spec = { + "paths": { + "/items": { + "get": {"operationId": "listItems", "tags": ["items"], "responses": {}} + } + } + } + import copy + original = copy.deepcopy(spec) + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + assert spec == original + + +# --------------------------------------------------------------------------- +# validate_unique_operation_ids +# --------------------------------------------------------------------------- + + +def test_validate_passes_when_all_ids_unique(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "responses": {}}}, + } + } + validate_unique_operation_ids(spec) # must not raise or exit + + +def test_validate_exits_on_duplicate(capsys): + spec = { + "paths": { + "/a": {"get": {"operationId": "dupOp", "responses": {}}}, + "/b": {"post": {"operationId": "dupOp", "responses": {}}}, + } + } + with pytest.raises(SystemExit) as exc_info: + validate_unique_operation_ids(spec) + assert exc_info.value.code == 1 + assert "dupOp" in capsys.readouterr().err + + +# --------------------------------------------------------------------------- +# apply_options_per_service +# --------------------------------------------------------------------------- + + +def test_options_per_service_sets_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/lm/document-grounding"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/lm/document-grounding"}] + + +def test_options_per_service_overwrites_existing_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/new/path"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {"servers": [{"url": "http://old-host"}]} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/new/path"}] + + +def test_options_per_service_missing_key_warns_and_does_not_modify(tmp_path, capsys): + options = {"other/key.yaml": {"basePath": "/other"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + assert "src/spec/api.yaml" in capsys.readouterr().err + + +def test_options_per_service_no_base_path_does_not_set_servers(tmp_path): + options = {"src/spec/api.yaml": {"packageName": "my_pkg"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + diff --git a/sample_code/Makefile b/sample_code/Makefile new file mode 100644 index 0000000..c9fe416 --- /dev/null +++ b/sample_code/Makefile @@ -0,0 +1,2 @@ +server: + uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload diff --git a/sample_code/README.md b/sample_code/README.md new file mode 100644 index 0000000..6b9ffe8 --- /dev/null +++ b/sample_code/README.md @@ -0,0 +1,41 @@ +# Sample Code - Work in Progress + +Sample code to demonstrate the usage of the SAP Cloud SDK for AI. + +## Prerequisites + +Before running the application, ensure the following prerequisites are met: + +- Python installation (3.10 or higher) +- uv installation (0.12) +- Credentials for [SAP AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/what-is-sap-ai-core) service configured. +- Deployments of the orchestration service as well as the following models in the resource group specified in the `.env` file below: + - `gpt-5.4-nano` + - `text-embedding-3-small` + - `anthropic--claude-4.6-sonnet` + - `gemini-3.5-flash` + +## Local Deployment + +Create a `.env` file in the sample-code directory with the complete content of your AI core service key by adding the following lines: + +```bash +AICORE_CLIENT_ID="..." +AICORE_CLIENT_SECRET="..." +AICORE_AUTH_URL="..." +AICORE_BASE_URL="..." +``` + +Optionally, you can add the `AICORE_RESOURCE_GROUP` environment variable to specify a resource group different from the `default` one. + +The server can be started with + +```bash +uv run uvicorn sample_code.server:app --app-dir src --env-file .env --reload +``` + +or by running ```make```. + +## Usage + +When the server is running, head to `http://localhost:8000/docs` to see all available endpoints. diff --git a/sample_code/pyproject.toml b/sample_code/pyproject.toml new file mode 100644 index 0000000..ed4b373 --- /dev/null +++ b/sample_code/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "sample-code" +version = "0.1.0" +description = "Sample code for using the AI Core Python SDK" +readme = "README.md" +requires-python = ">=3.10" +dependencies = [ + "fastapi>=0.141.1", + "sap-ai-sdk-gen", + "uvicorn>=0.52.1", +] + +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["."] +include = ["src*"] + +[tool.setuptools.package-dir] +"sample_code" = "src" + +[tool.uv.sources] +sap-ai-sdk-gen = { workspace = true, editable = true } diff --git a/sample_code/pyrightconfig.json b/sample_code/pyrightconfig.json new file mode 100644 index 0000000..bec92e0 --- /dev/null +++ b/sample_code/pyrightconfig.json @@ -0,0 +1,9 @@ +{ + "venvPath": "..", + "venv": ".venv", + "extraPaths": [ + "../packages/base", + "../packages/core", + "../packages/gen" + ] +} diff --git a/sample_code/src/__init__.py b/sample_code/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sample_code/src/amazon.py b/sample_code/src/amazon.py new file mode 100644 index 0000000..8d5e2cf --- /dev/null +++ b/sample_code/src/amazon.py @@ -0,0 +1,25 @@ +from gen_ai_hub.proxy.native.amazon import Session + + +def converse(): + """ + Run chat example for Claude 4.6 Sonnet. + + Returns: + JSON object containing the model response as result. + """ + bedrock = Session().client(model_name="anthropic--claude-4.6-sonnet") + conversation = [ + { + "role": "user", + "content": [ + { + "text": "Describe the purpose of a 'Hello World' program in one sentence." + } + ], + } + ] + response = bedrock.converse( + messages=conversation, + ) + return {"result": response["output"]["message"]["content"][0]["text"]} diff --git a/sample_code/src/core.py b/sample_code/src/core.py new file mode 100644 index 0000000..e92f1af --- /dev/null +++ b/sample_code/src/core.py @@ -0,0 +1,80 @@ +from typing import Annotated + +from ai_api_client_sdk.models.parameter_binding import ParameterBinding +from ai_core_sdk.ai_core_v2_client import AICoreV2Client +from fastapi import Body + + +def get_configurations(): + """ + Get all configurations for the resource group specified in the .env file. + + Returns: + A dict containing the configurations in a ConfigurationQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.configuration.query() + + +def create_configuration(): + """ + Create configuration for GPT-5.4-nano. + + The configuration is created for the resource group specified in the .env file. + """ + client = AICoreV2Client.from_env() + # for illustrative purposes the example config is hardcoded + parameter_bindings = [ + ParameterBinding.from_dict({"key": "modelName", "value": "gpt-5.4-nano"}), + ParameterBinding.from_dict({"key": "modelVersion", "value": "latest"}), + ] + return client.configuration.create( + name="my-gpt-5.4-nano-config", + scenario_id="foundation-models", + executable_id="azure-openai", + parameter_bindings=parameter_bindings, + input_artifact_bindings=[], + ) + + +def get_deployments(): + """ + Get all deployments for the resource group specified in the .env file. + + Returns: + A dict containing the deployments in a DeploymentQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.deployment.query() + + +def create_deployment(configuration_id: Annotated[str, Body(embed=True)]): + """ + Create deployment for the configuration_id in the request body. + + The deployment is created for the resource group specified in the .env file. + """ + client = AICoreV2Client.from_env() + return client.deployment.create(configuration_id=configuration_id) + + +def get_scenarios(): + """ + Get all scenarios. + + Returns: + A dict containing the scenarios in a ScenarioQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.scenario.query() + + +def get_models(): + """ + Get all available models. + + Returns: + A dict containing the models in a ModelQueryResponse object. + """ + client = AICoreV2Client.from_env() + return client.model.query() diff --git a/sample_code/src/document_grounding_generation.py b/sample_code/src/document_grounding_generation.py new file mode 100644 index 0000000..00299d6 --- /dev/null +++ b/sample_code/src/document_grounding_generation.py @@ -0,0 +1,79 @@ +from ai_core_sdk.ai_core_v2_client import AICoreV2Client +from gen_ai_hub.document_grounding_generation import ( + GroundingApiClient, + CollectionRequest, + EmbeddingConfig, + PipelinesApi, + RetrievalApi, + RetrievalSearchConfiguration, + RetrievalSearchFilter, + RetrievalSearchInput, + TextSearchRequest, + VectorApi, +) + +RESOURCE_GROUP = "default" + + +def _client() -> GroundingApiClient: + return GroundingApiClient(AICoreV2Client.from_env()) + + +async def create_collection(): + """ + Create a new vector collection through the Document Grounding Vector API. + + Returns: + JSON object containing the created collection details. + """ + client = _client() + result = await VectorApi(client).create_collection( + collection_request=CollectionRequest( + title="my-collection", + embeddingConfig=EmbeddingConfig(modelName="text-embedding-3-small"), + ), + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} + + +async def get_all_pipelines(): + """ + List all document grounding pipelines through the Document Grounding Pipelines API. + + Returns: + JSON object containing the list of pipelines. + """ + client = _client() + result = await PipelinesApi(client).get_all_pipelines( + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} + + +async def retrieval_search(): + """ + Search across data repositories through the Document Grounding Retrieval API. + + Returns: + JSON object containing the search results. + """ + client = _client() + result = await RetrievalApi(client).search( + text_search_request=TextSearchRequest( + query="What is SAP BTP?", + filters=[ + RetrievalSearchFilter( + id="my-data-repository-id", + search_configuration=RetrievalSearchConfiguration( + max_chunk_count=5, + ), + ) + ], + search_configuration=RetrievalSearchInput( + max_chunk_count=10, + ), + ), + header_parameters={"AI-Resource-Group": RESOURCE_GROUP}, + ) + return {"result": result.to_dict()} diff --git a/sample_code/src/google.py b/sample_code/src/google.py new file mode 100644 index 0000000..bb02697 --- /dev/null +++ b/sample_code/src/google.py @@ -0,0 +1,69 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.proxy import get_proxy_client +from gen_ai_hub.proxy.native.google_genai import Client +from google.genai import types + + +def generate(): + """ + Run chat example for Gemini 3.5 Flash. + + Returns: + JSON object containing the model response as result. + """ + proxy_client = get_proxy_client("gen-ai-hub") + client = Client(proxy_client=proxy_client) + response = client.models.generate_content( + model="gemini-3.5-flash", contents="How many paws are there for a dog?" + ) + return {"result": response.candidates[0].content.parts[0].text} + + +def generate_stream(): + """ + Run chat example with streaming response for Gemini 3.5 Flash. + + Returns: + Streaming response emitting the produced text. + """ + proxy_client = get_proxy_client("gen-ai-hub") + + client = Client( + proxy_client=proxy_client, + ) + + def stream(): + stream = client.models.generate_content_stream( + model="gemini-3.5-flash", contents="Explain singularity in short terms." + ) + for chunk in stream: + if chunk.text: + yield chunk.text + + return StreamingResponse(stream(), media_type="text/plain") + + +def tool_call(): + """ + Run chat example including a tool call for Gemini 3.5 Flash. + + Returns: + JSON object containing the model response as result. + """ + + # addition tool to call + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + proxy_client = get_proxy_client("gen-ai-hub") + + client = Client( + proxy_client=proxy_client, + ) + response = client.models.generate_content( + model="gemini-3.5-flash", + contents="What is 769 + 348?", + config=types.GenerateContentConfig(tools=[add]), + ) + return {"result": response.candidates[0].content.parts[0].text} diff --git a/sample_code/src/openai.py b/sample_code/src/openai.py new file mode 100644 index 0000000..934acf9 --- /dev/null +++ b/sample_code/src/openai.py @@ -0,0 +1,169 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.proxy.native.openai import AsyncOpenAI, chat, embeddings, responses +from openai.types.responses import Response +from pydantic import BaseModel + + +def chat_completion(): + """ + Run chat example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object containing the model response as result. + """ + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, + { + "role": "assistant", + "content": "Yes, customer managed keys are supported by Azure OpenAI.", + }, + { + "role": "user", + "content": "Do other Azure Cognitive Services support this too?", + }, + ] + response = chat.completions.create(model_name="gpt-5.4-nano", messages=messages) + return {"result": response.choices[0].message.content} + + +async def chat_completion_async(): + """ + Run async chat example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object containing the model response as result. + """ + client = AsyncOpenAI() + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, + { + "role": "assistant", + "content": "Yes, customer managed keys are supported by Azure OpenAI.", + }, + { + "role": "user", + "content": "Do other Azure Cognitive Services support this too?", + }, + ] + response = await client.chat.completions.create( + model_name="gpt-5.4-nano", messages=messages + ) + await client.close() + return {"result": response.choices[0].message.content} + + +def chat_completion_structured(): + """ + Run structured output (JSON) example for GPT-5.4-nano with the ChatCompletions API. + + Returns: + JSON object response from the model. + """ + + class Person(BaseModel): + name: str + age: int + + response = chat.completions.parse( + model_name="gpt-5.4-nano", + messages=[{"role": "user", "content": "Tell me about John Doe, aged 30."}], + response_format=Person, + ) + return response.choices[0].message.parsed + + +def chat_completion_stream(): + """ + Run chat example with streaming response for GPT-5.4-nano with the ChatCompletions API. + + Returns: + Streaming response emitting the produced text. + """ + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Count from 1 to 10, one number per line."}, + ] + + def generate(): + stream = chat.completions.create( + model_name="gpt-5.4-nano", + messages=messages, + stream=True, + ) + for chunk in stream: + if chunk.choices: + content = chunk.choices[0].delta.content + if content: + yield content + + return StreamingResponse(generate(), media_type="text/plain") + + +def responses_simple(): + """ + Run chat example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object containing the model response as result. + """ + response = responses.create( + model="gpt-5.4-nano", + instructions="You are a helpful assistant.", + input="What is the capital of France?", + ) + return {"result": response.output[0].content[0].text} + + +async def responses_simple_async(): + """ + Run async chat example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object containing the model response as result. + """ + client = AsyncOpenAI() + response: Response = await client.responses.create( # type: ignore[assignment] + model="gpt-5.4-nano", + instructions="You are a helpful assistant.", + input="What is the capital of France?", + ) + await client.close() + return {"result": response.output[0].content[0].text} # type: ignore[union-attr] + + +def responses_structured(): + """ + Run structured output (JSON) example for GPT-5.4-nano with the Responses API. + + Returns: + JSON object response from the model. + """ + + class Person(BaseModel): + name: str + age: int + + response = responses.parse( + model="gpt-5.4-nano", + input="Tell me about John Doe aged 30.", + text_format=Person, + ) + return response.output_parsed + + +def embedding(): + """ + Run embedding example. + + Returns: + JSON object containing the embedding. + """ + result = embeddings.create( + model_name="text-embedding-3-small", + input="The quick brown fox jumps over the lazy dog.", + ) + return { + "result": result.data[0].embedding, + } diff --git a/sample_code/src/orchestration.py b/sample_code/src/orchestration.py new file mode 100644 index 0000000..7088744 --- /dev/null +++ b/sample_code/src/orchestration.py @@ -0,0 +1,867 @@ +from fastapi.responses import StreamingResponse +from gen_ai_hub.orchestration_v2 import ( + AzureContentSafetyInput, + AzureContentSafetyInputFilterConfig, + AzureContentSafetyOutput, + AzureContentSafetyOutputFilterConfig, + AzureThreshold, + DPICustomEntity, + DPIMethodConstant, + DPIStandardEntity, + EmbeddingsInput, + EmbeddingsModelConfig, + EmbeddingsModelDetails, + EmbeddingsModuleConfigs, + EmbeddingsOrchestrationConfig, + FilteringModuleConfig, + FunctionObject, + FunctionTool, + GlobalStreamOptions, + ImageItem, + InputFiltering, + InputTranslationConfig, + JSONResponseSchema, + LlamaGuard38bFilter, + LlamaGuard38bFilterConfig, + LLMModelDetails, + MaskingMethod, + MaskingModuleConfig, + MaskingProviderConfig, + ModuleConfig, + OrchestrationConfig, + OrchestrationError, + OrchestrationService, + OutputFiltering, + OutputTranslationConfig, + ProfileEntity, + PromptTemplatingModuleConfig, + ResponseFormatJsonSchema, + SAPDocumentTranslationInput, + SAPDocumentTranslationOutput, + SystemMessage, + Template, + ToolChatMessage, + TranslationModuleConfig, + UserMessage, + function_tool, +) + + +def completion(): + """ + Run chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +async def completion_async(): + """ + Run async chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = await service.arun() + await service.aclose_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_stream(): + """ + Run chat example with a streaming response through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ), + stream=GlobalStreamOptions(enabled=True), + ) + service = OrchestrationService(config=config) + + def generate(): + stream = service.stream() + for chunk in stream: + if chunk.final_result: + content = chunk.final_result.choices[0].delta.content + if content: + yield content + service.close_http_connection() + + return StreamingResponse(generate(), media_type="text/plain") + + +def completion_json(): + """ + Run chat example with structured output (JSON) through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + json_schema = { + "title": "Person", + "type": "object", + "properties": { + "firstName": {"type": "string", "description": "The person's first name."}, + "lastName": {"type": "string", "description": "The person's last name."}, + }, + } + + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage(content="Format the response as json."), + UserMessage(content="Who was the first person on the moon?"), + ], + # setting ResponseFormatJsonObject() enables JSON responses without a fixed schema + response_format=ResponseFormatJsonSchema( + json_schema=JSONResponseSchema( + name="person", + description="person mapping", + schema=json_schema, + ) + ), + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_template(): + """ + Run chat example with a template including placeholders through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + # add placeholder by wrapping it with {{?...}} + UserMessage(content="What is the capital of {{?country}}?") + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + # provide placeholder values + result = service.run(placeholder_values={"country": "Denmark"}) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_with_fallback(): + """ + Run chat example with fallback configurations through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=[ + # Trigger fallback with non-orchestration model + ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="sap-rpt-1-small"), + ) + ), + # Second configuration will succeed + ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="anthropic--claude-4.5-haiku"), + ) + ), + ] + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def completion_abap(): + """ + Run chat example with SAP ABAP through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="Explain the concept of internal tables in ABAP" + ) + ] + ), + model=LLMModelDetails(name="sap-abap-1"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def message_history(): + """ + Run chat example with message history through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # the service can also be started without providing a default config + # in this case, each call to service.run has to pass a config to use + service = OrchestrationService() + first_config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[UserMessage(content="What is the capital of France?")] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + + first_response = service.run(config=first_config) + # first_response.intermediate_results.templating contains the history + history = first_response.intermediate_results.templating or [] + history.append(first_response.final_result.choices[0].message) + + second_config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[UserMessage(content="What is the typical food there?")] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + second_response = service.run(config=second_config, history=history) + service.close_http_connection() + return {"result": second_response.final_result.choices[0].message.content} + + +def completion_image(): + """ + Run multimodal example with image input through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # First option: load image from a standard, publicly accessible url + image = ImageItem(url="https://picsum.photos/id/1/200/300") + # Second option: pass the image content as base64-encoded data url + # with the format "data:[][;base64]," + # image = ImageItem( + # url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAE0lEQVR4nGP8z4APMOGVZRip0gBBLAETee26JgAAAABJRU5ErkJggg==" + # ) + # Third option: load the image from a local file path + # try: + # image = ImageItem.from_file("path/to/your/local/image.jpeg") + # except FileNotFoundError: + # print("Error: The specified image file was not found.") + # except Exception as e: + # print(f"An error occurred while loading the image: {e}") + multimodal_content = [image, "What objects are prominent in this image?"] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + # add placeholder by wrapping it with {{?...}} + UserMessage(content=multimodal_content) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def input_filtering(): + """ + Run input filtering example through the Orchestration Service API. + + Returns: + JSON object containing a message confirming successful filtering. + Raises: + RuntimeError: Raised if the filtering is unsuccesful. + """ + content_filter_config = FilteringModuleConfig( + input=InputFiltering( + filters=[ + AzureContentSafetyInputFilterConfig( + # only safe content allowed for hate and violence + config=AzureContentSafetyInput( + hate=AzureThreshold.ALLOW_SAFE, + violence=AzureThreshold.ALLOW_SAFE, + ) + ), + # category 'privacy' enabled + LlamaGuard38bFilterConfig(config=LlamaGuard38bFilter(privacy=True)), + ] + ) + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + # should be filtered by Llama Guard + content="My social insurance number is ABC123456789." + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + filtering=content_filter_config, + ) + ) + service = OrchestrationService(config=config) + try: + service.run() + raise RuntimeError("Input was not filtered as expected") + except OrchestrationError as e: + if e.code == 400: + return {"result": "Input was filtered as expected."} + else: + raise + finally: + service.close_http_connection() + + +def output_filtering(): + """ + Run output filtering example through the Orchestration Service API. + + Returns: + JSON object containing a message confirming successful filtering. + Raises: + RuntimeError: Raised if the filtering is unsuccesful. + """ + content_filter_config = FilteringModuleConfig( + output=OutputFiltering( + filters=[ + AzureContentSafetyOutputFilterConfig( + # only safe content allowed for hate and violence + config=AzureContentSafetyOutput( + hate=AzureThreshold.ALLOW_SAFE, + violence=AzureThreshold.ALLOW_SAFE, + ) + ), + # category 'privacy' enabled + LlamaGuard38bFilterConfig(config=LlamaGuard38bFilter(privacy=True)), + ] + ) + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + # should be filtered by Azure content filter + content="Reparaphrase the sentence in 30 ways with strong feelings: 'I hate you!'." + ) + ] + ), + model=LLMModelDetails(name="anthropic--claude-4.5-haiku"), + ), + filtering=content_filter_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + # should be filtered by the Azure content filter, hence content should be empty + if result.final_result.choices[0].message.content: + raise RuntimeError("Output was not filtered as expected") + else: + return {"result": "Output was filtered as expected"} + + +def completion_masking(): + """ + Run masked (pseudonymized) chat example through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + data_masking_config = MaskingModuleConfig( + providers=[ + MaskingProviderConfig( + method=MaskingMethod.PSEUDONYMIZATION, + entities=[ + DPIStandardEntity(type=ProfileEntity.ADDRESS), + DPIStandardEntity(type=ProfileEntity.EMAIL), + DPIStandardEntity(type=ProfileEntity.PHONE), + DPIStandardEntity(type=ProfileEntity.PERSON), + DPICustomEntity( + regex="[0-9]{4}[-/][0-9]{2}[-/][0-9]{2}", + replacement_strategy=DPIMethodConstant(value="MASKED_DATE"), + ), + ], + ) + ] + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="Generate HTML that shows the contact info for Jane Doe, born on 1975-03-05, living at 10 Downing Street, London UK with email 'jane.doe@mailprovider.com' and phone number +4902044123221." + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + masking=data_masking_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def translation(): + """ + Run chat example with prompt and output translation through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + translation_config = TranslationModuleConfig( + input=SAPDocumentTranslationInput( + config=InputTranslationConfig( + source_language="en-US", target_language="de-DE" + ) + ), + output=SAPDocumentTranslationOutput( + config=OutputTranslationConfig( + source_language="de-DE", target_language="fr-FR" + ) + ), + ) + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What is the longest river on planet earth?" + ) + ] + ), + model=LLMModelDetails(name="gpt-5.4-nano"), + ), + translation=translation_config, + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def sonar_with_citations(): + """ + Run chat example with citations (Sonar model) through the Orchestration Service API. + + Returns: + JSON object containing the model response (text and citations) as result. + """ + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + UserMessage( + content="What are the latest developments in quantum computing?" + ) + ] + ), + model=LLMModelDetails(name="sonar"), + ) + ) + ) + service = OrchestrationService(config=config) + result = service.run() + service.close_http_connection() + return { + "result": { + "text": result.final_result.choices[0].message.content, + "citations": result.final_result.citations, + } + } + + +def embedding(): + """ + Run embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ) + ) + ) + + service = OrchestrationService() + response = service.embed( + config=embedding_config, input=EmbeddingsInput(text="Hello World!") + ) + service.close_http_connection() + return {"result": response.final_result.data[0].embedding} + + +def embedding_batched(): + """ + Run batched embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ) + ) + ) + + input_list = ["Hello World!", "This is your captain speaking"] + + service = OrchestrationService() + response = service.embed( + config=embedding_config, input=EmbeddingsInput(text=input_list) + ) + service.close_http_connection() + return {"result": response.final_result.data} + + +def embedding_masked(): + """ + Run masked (anonymized )embedding example through the Orchestration Service API. + + Returns: + JSON object containing the embedding as result. + """ + embedding_config = EmbeddingsOrchestrationConfig( + modules=EmbeddingsModuleConfigs( + embeddings=EmbeddingsModelConfig( + model=EmbeddingsModelDetails(name="text-embedding-3-small") + ), + masking=MaskingModuleConfig( + providers=[ + MaskingProviderConfig( + method=MaskingMethod.ANONYMIZATION, + entities=[ + DPIStandardEntity(type=ProfileEntity.PERSON), + DPIStandardEntity(type=ProfileEntity.EMAIL), + DPIStandardEntity(type=ProfileEntity.PHONE), + ], + ) + ] + ), + ) + ) + + service = OrchestrationService() + response = service.embed( + config=embedding_config, + input=EmbeddingsInput( + text="Contact John Smith at john.smith@example.com or call 555-123-4567." + ), + ) + service.close_http_connection() + return {"result": response.final_result.data[0].embedding} + + +def tool_call_decorator(): + """ + Run chat example with tool calls using the `function_tool` decorator through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + + @function_tool + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + tools = [add] + + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if not tool_calls: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = add.execute(**tool_call.function.parse_arguments()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def tool_call_function_tool(): + """ + Run chat example with tool calls using the `FunctionTool` class through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + + def add(a: int, b: int) -> int: + """Add two numbers.""" + return a + b + + add_tool = FunctionTool( + function=FunctionObject( + name="add", + description="Add two numbers.", + parameters={ + "type": "object", + "properties": { + "a": { + "type": "number", + "description": "First operand of the addition function", + }, + "b": { + "type": "number", + "description": "Second operand of the addition function", + }, + }, + "required": ["a", "b"], + "additionalProperties": False, + }, + strict=True, + function=add, + ) + ) + + tools = [add_tool] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if tool_calls is None: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = add_tool.execute(**tool_call.function.parse_arguments()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} + + +def tool_call_json(): + """ + Run chat example with tool calls using a JSON schema dictionary through the Orchestration Service API. + + Returns: + JSON object containing the model response as result. + """ + # this is helpful if the tool call doesn't map to a Python function + tools = [ + { + "type": "function", + "function": { + "name": "add", + "description": "Add two numbers.", + "parameters": { + "type": "object", + "properties": { + "a": { + "type": "number", + "description": "First operand of the addition function", + }, + "b": { + "type": "number", + "description": "Second operand of the addition function", + }, + }, + "required": ["a", "b"], + "additionalProperties": False, + }, + "strict": True, + }, + } + ] + config = OrchestrationConfig( + modules=ModuleConfig( + prompt_templating=PromptTemplatingModuleConfig( + prompt=Template( + template=[ + SystemMessage( + content="You are a helpful AI that performs the addition of two numbers." + ), + UserMessage(content="What is 279 + 929?"), + ], + tools=tools, + ), + model=LLMModelDetails(name="gpt-4o"), + ) + ) + ) + + service = OrchestrationService() + result = service.run(config=config) + tool_calls = result.final_result.choices[0].message.tool_calls + if tool_calls is None: + raise RuntimeError("Unexpectedly no tool calls in response") + + history = list(result.intermediate_results.templating or []) + history.append(result.final_result.choices[0].message) + for tool_call in tool_calls: + if tool_call.function.name != "add": + raise RuntimeError( + f"Unexpectedly called '{tool_call.function.name}' instead of 'add'" + ) + result = sum(tool_call.function.parse_arguments().values()) + tool_message = ToolChatMessage(content=str(result), tool_call_id=tool_call.id) + history.append(tool_message) + + result = service.run(config=config, history=history) + service.close_http_connection() + return {"result": result.final_result.choices[0].message.content} diff --git a/sample_code/src/server.py b/sample_code/src/server.py new file mode 100644 index 0000000..168b51a --- /dev/null +++ b/sample_code/src/server.py @@ -0,0 +1,77 @@ +from fastapi import FastAPI, Request +from fastapi.responses import JSONResponse + +from sample_code import openai, amazon, core, google, orchestration, document_grounding_generation + +app = FastAPI(title="SAP AI Core Python SDK Sample Application") + + +# no specific error handling, simply return error message +@app.exception_handler(Exception) +async def global_exception_handler(request: Request, exc: Exception): + return JSONResponse(status_code=500, content={"error": str(exc)}) + + +# NOTE: /docs contains an auto-generated overview of the routes + + +@app.get("/") +@app.get("/health") +async def health(): + return {"status": "ok"} + + +# AI Core (Configurations/Deployments) +app.get("/core/configurations")(core.get_configurations) +app.post("/core/configuration/create")(core.create_configuration) +app.get("/core/deployments")(core.get_deployments) +app.post("/core/deployment/create")(core.create_deployment) +app.get("/core/scenarios")(core.get_scenarios) +app.get("/core/models")(core.get_models) + +# Azure/OpenAI +app.get("/openai/chat-completion")(openai.chat_completion) +app.get("/openai/chat-completion-stream")(openai.chat_completion_stream) +app.get("/openai/chat-completion-structured")(openai.chat_completion_structured) +app.get("/openai/chat-completion-async")(openai.chat_completion_async) +app.get("/openai/responses")(openai.responses_simple) +app.get("/openai/responses-structured")(openai.responses_structured) +app.get("/openai/responses-async")(openai.responses_simple_async) +app.get("/openai/embedding")(openai.embedding) + +# Google +app.get("/google/generate")(google.generate) +app.get("/google/generate-stream")(google.generate_stream) +app.get("/google/tool-call")(google.tool_call) + +# Amazon/Anthropic +app.get("/amazon/converse")(amazon.converse) + +# Orchestration +app.get("/orchestration/completion")(orchestration.completion) +app.get("/orchestration/completion-async")(orchestration.completion_async) +app.get("/orchestration/completion-stream")(orchestration.completion_stream) +app.get("/orchestration/completion-template")(orchestration.completion_template) +app.get("/orchestration/completion-json")(orchestration.completion_json) +app.get("/orchestration/completion-with-fallback")( + orchestration.completion_with_fallback +) +app.get("/orchestration/completion-abap")(orchestration.completion_abap) +app.get("/orchestration/message-history")(orchestration.message_history) +app.get("/orchestration/completion-image")(orchestration.completion_image) +app.get("/orchestration/input-filtering")(orchestration.input_filtering) +app.get("/orchestration/output-filtering")(orchestration.output_filtering) +app.get("/orchestration/completion-masking")(orchestration.completion_masking) +app.get("/orchestration/translation")(orchestration.translation) +app.get("/orchestration/citations")(orchestration.sonar_with_citations) +app.get("/orchestration/embedding")(orchestration.embedding) +app.get("/orchestration/embedding-batched")(orchestration.embedding_batched) +app.get("/orchestration/embedding-masked")(orchestration.embedding_masked) +app.get("/orchestration/tool-call-decorator")(orchestration.tool_call_decorator) +app.get("/orchestration/tool-call-function-tool")(orchestration.tool_call_function_tool) +app.get("/orchestration/tool-call-json")(orchestration.tool_call_json) + +# Document Grounding Generation (generated client) +app.post("/document-grounding-generation/collection/create")(document_grounding_generation.create_collection) +app.get("/document-grounding-generation/pipelines")(document_grounding_generation.get_all_pipelines) +app.post("/document-grounding-generation/retrieval/search")(document_grounding_generation.retrieval_search)