| | |
- builtins.object
-
- gen_ai_hub.document_grounding.clients.pipeline_api_client.PipelineAPIClient
- gen_ai_hub.document_grounding.clients.retrieval_api_client.RetrievalAPIClient
- gen_ai_hub.document_grounding.clients.vector_api_client.VectorAPIClient
class PipelineAPIClient(builtins.object) |
| |
PipelineAPIClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
The Pipelines API creates and manages vector stores based on documents from user data repositories:
S3, SFTP, and Microsoft SharePoint.
Each pipeline represents a configured end-to-end process including the following steps:
- Fetches documents from a supported data source
- Preprocesses and chunks the document content, and generates semantic embeddings.
Semantic embeddings are multidimensional representations of textual information.
- Stores semantic embeddings into the HANA Vector Store
The Pipeline API is compatible with the following data repositories:
- Microsoft SharePoint
- AWS S3
- SFTP
See https://api.sap.com/api/DOCUMENT_GROUNDING_API/resource/Pipelines |
| |
Methods defined here:
- __init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
- Initializes the PipelineAPIClient
:param proxy_client: proxy client to use for requests, defaults to None
:type proxy_client: Optional[GenAIHubProxyClient], optional
- create_pipeline(self, pipeline_request: Union[gen_ai_hub.document_grounding.models.pipeline.MSSharePointPipelineCreateRequest, gen_ai_hub.document_grounding.models.pipeline.S3PipelineCreateRequest, gen_ai_hub.document_grounding.models.pipeline.SFTPPipelineCreateRequest]) -> gen_ai_hub.document_grounding.models.pipeline.PipelineIdResponse
- Create a document vectorization pipeline
:param pipeline_request: The object containing the pipeline configuration.
:type pipeline_request: CreatePipelineRequest
:return: ID of the created pipeline
:rtype: PipelineIdResponse
- delete_pipeline_by_id(self, pipeline_id: str) -> requests.models.Response
- Delete a pipeline by pipeline id
:param pipeline_id: ID of the pipeline to delete
:type pipeline_id: str
:return: Response of the delete operation
:rtype: requests.Response
- get_execution_document_by_id(self, pipeline_id: str, execution_id: str, document_id: str) -> gen_ai_hub.document_grounding.models.pipeline.Document
- Get Document by ID for a Pipeline Execution
:return: Document for the Pipeline Execution
:rtype: Document
- get_execution_documents(self, pipeline_id: str, execution_id: str, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.pipeline.DocumentsStatusResponse
- Get Documents for a Pipeline Execution
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:param execution_id: Execution ID
:type execution_id: str
:param top: the maximum number of documents to return, defaults to None
:type top: Optional[int], optional
:param skip: number of documents to skip, defaults to None
:type skip: Optional[int], optional
:param count: flag to include count of total documents, defaults to None
:type count: Optional[bool], optional
:return: Documents for the Pipeline Execution
:rtype: DocumentsStatusResponse
- get_pipeline_by_id(self, pipeline_id: str) -> gen_ai_hub.document_grounding.models.pipeline.BasePipelineResponse
- Get details of a pipeline by pipeline id.
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:return: Details of the pipeline
:rtype: BasePipelineResponse
- get_pipeline_document_by_id(self, pipeline_id: str, document_id: str) -> gen_ai_hub.document_grounding.models.pipeline.Document
- Get Document by ID for a Pipeline
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:param document_id: Document ID
:type document_id: str
:return: Document for the Pipeline
:rtype: Document
- get_pipeline_documents(self, pipeline_id: str, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.pipeline.DocumentsStatusResponse
- Get Documents for a Pipeline
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:param top: the maximum number of documents to return, defaults to None
:type top: Optional[int], optional
:param skip: number of documents to skip, defaults to None
:type skip: Optional[int], optional
:param count: flag to include count of total documents, defaults to None
:type count: Optional[bool], optional
:return: Documents for the Pipeline
:rtype: DocumentsStatusResponse
- get_pipeline_execution_by_id(self, pipeline_id: str, execution_id: str) -> gen_ai_hub.document_grounding.models.pipeline.PipelineExecution
- Get Pipeline Execution by ID
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:param execution_id: Execution ID
:type execution_id: str
:return: Pipeline Execution
:rtype: PipelineExecution
- get_pipeline_executions(self, pipeline_id: str, last_execution: Optional[bool] = None, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.pipeline.GetPipelineExecutionsResponse
- Get Pipeline Executions
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:param last_execution: flag to get only the last execution, defaults to None
:type last_execution: Optional[bool], optional
:param top: number of executions to retrieve, defaults to None
:type top: Optional[int], optional
:param skip: number of executions to skip, defaults to None
:type skip: Optional[int], optional
:param count: flag to include count of total executions, defaults to None
:type count: Optional[bool], optional
:return: Pipeline Executions
:rtype: GetPipelineExecutionsResponse
- get_pipeline_status(self, pipeline_id: str) -> gen_ai_hub.document_grounding.models.pipeline.GetPipelineStatusResponse
- Get pipeline status by pipeline id
:param pipeline_id: Pipeline ID
:type pipeline_id: str
:return: Status of the pipeline
:rtype: GetPipelineStatusResponse
- get_pipelines(self, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.pipeline.GetPipelinesResponse
- Get all pipelines.
:return: Get all pipelines
:rtype: GetPipelinesResponse
- search_pipelines(self, body: gen_ai_hub.document_grounding.models.pipeline.SearchPipelineRequest) -> gen_ai_hub.document_grounding.models.pipeline.SearchPipelinesResponse
- Pipeline Search by Metadata
:param body: The search request object containing metadata filters.
:type body: SearchPipelineRequest
:return: Search results containing matching pipelines.
:rtype: SearchPipelinesResponse
- trigger_pipeline(self, request: gen_ai_hub.document_grounding.models.pipeline.ManualPipelineTrigger) -> requests.models.Response
- Trigger Pipeline Manually
:param request: The manual trigger request object.
:type request: ManualPipelineTrigger
:return: Response of the trigger operation
:rtype: requests.Response
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class RetrievalAPIClient(builtins.object) |
| |
RetrievalAPIClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
The Retrieval API enables querying and retrieving relevant content from configured data repositories,
such as vector or external document sources (e.g., help.sap.com).
Retrieval combines semantic search with repository metadata filtering and supports custom
retrieval configurations for chunk/document granularity.
Reference: https://api.sap.com/api/DOCUMENT_GROUNDING_API/resource/Retrieval |
| |
Methods defined here:
- __init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
- Initialize the RetrievalAPIClient.
:param proxy_client: Optional proxy client for making API requests.
:type proxy_client: Optional[GenAIHubProxyClient], optional
- get_data_repositories(self, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.retrieval.DataRepositories
- List all data repositories available to the tenant.
:param top: the number of items to return, defaults to None
:type top: Optional[int], optional
:param skip: the number of items to skip, defaults to None
:type skip: Optional[int], optional
:param count: whether to include a count of total items, defaults to None
:type count: Optional[bool], optional
:return: DataRepositories model containing the list of data repositories
:rtype: DataRepositories
- get_data_repository_by_id(self, repository_id: str) -> gen_ai_hub.document_grounding.models.retrieval.DataRepository
- Get a single data repository by its unique ID.
:param repository_id: the unique identifier of the data repository
:type repository_id: str
:return: DataRepository model representing the data repository
:rtype: DataRepository
- search(self, search_input: gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchInput) -> gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchResults
- Perform a retrieval search for relevant content.
:param search_input: RetrievalSearchInput model defining the query and filters.
:type search_input: RetrievalSearchInput
:return: RetrievalSearchResults model containing repositories, documents, and chunks.
:rtype: RetrievalSearchResults
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class VectorAPIClient(builtins.object) |
| |
VectorAPIClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
The Vector API provides management and search capabilities for vector-based document collections.
It enables creating, retrieving, updating, and deleting collections, as well as
managing documents and performing semantic vector searches within those collections.
Reference: https://api.sap.com/api/DOCUMENT_GROUNDING_API/resource/Vector |
| |
Methods defined here:
- __init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
- Initializes the VectorAPIClient
:param proxy_client: Optional proxy client to use for requests
:type proxy_client: Optional[GenAIHubProxyClient], optional
- create_collection(self, collection_request: gen_ai_hub.document_grounding.models.vector.CollectionCreateRequest) -> requests.models.Response
- Create a new collection.
:param collection_request: The object containing the collection configuration.
:type collection_request: CollectionCreateRequest
:return: requests.Response empty object with 202 status code
:rtype: requests.Response
- create_documents(self, collection_id: str, request: gen_ai_hub.document_grounding.models.vector.DocumentsCreateRequest) -> gen_ai_hub.document_grounding.models.vector.DocumentsListResponse
- Create documents in a collection.
:param collection_id: The ID of the collection to add documents to.
:type collection_id: str
:param request: The object containing the documents to create.
:type request: DocumentsCreateRequest
:return: A DocumentsListResponse object containing the created documents
:rtype: DocumentsListResponse
- delete_collection(self, collection_id: str) -> requests.models.Response
- Delete collection by ID.
:param collection_id: The ID of the collection to delete.
:type collection_id: str
:return: requests.Response empty object with 204 status code
:rtype: requests.Response
- delete_document(self, collection_id: str, document_id: str) -> requests.models.Response
- Delete a document from a collection.
:param collection_id: The ID of the collection to delete the document from.
:type collection_id: str
:param document_id: The ID of the document to delete.
:type document_id: str
:return: requests.Response empty object with 204 status code
:rtype: requests.Response
- get_collection_by_id(self, collection_id: str) -> gen_ai_hub.document_grounding.models.vector.Collection
- Get collection details by ID.
:param collection_id: The ID of the collection to retrieve.
:type collection_id: str
:return: A Collection object containing the collection details
:rtype: Collection
- get_collection_creation_status(self, collection_id: str) -> typing.Annotated[gen_ai_hub.document_grounding.models.vector.CollectionCreatedResponse | gen_ai_hub.document_grounding.models.vector.CollectionPendingResponse, FieldInfo(annotation=NoneType, required=True, discriminator='status')]
- Get creation status for a collection.
:param collection_id: The ID of the collection to retrieve the creation status for.
:type collection_id: str
:return: A CollectionCreationStatusResponse object containing the creation status
:rtype: CollectionCreationStatusResponse
- get_collection_deletion_status(self, collection_id: str) -> typing.Annotated[gen_ai_hub.document_grounding.models.vector.CollectionDeletedResponse | gen_ai_hub.document_grounding.models.vector.CollectionPendingResponse, FieldInfo(annotation=NoneType, required=True, discriminator='status')]
- Get deletion status for a collection.
:param collection_id: The ID of the collection to retrieve the deletion status for.
:type collection_id: str
:return: A CollectionDeletionStatusResponse object containing the deletion status
:rtype: CollectionDeletionStatusResponse
- get_collections(self, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.vector.CollectionsListResponse
- Get all collections.
:param top: the number of collections to retrieve, defaults to None
:type top: Optional[int], optional
:param skip: the number of collections to skip, defaults to None
:type skip: Optional[int], optional
:param count: whether to include the total count of collections, defaults to None
:type count: Optional[bool], optional
:return: A CollectionsListResponse object containing the list of collections
:rtype: CollectionsListResponse
- get_document_by_id(self, collection_id: str, document_id: str) -> gen_ai_hub.document_grounding.models.vector.Document
- Get a document by ID from a collection.
:param collection_id: The ID of the collection to retrieve the document from.
:type collection_id: str
:param document_id: The ID of the document to retrieve.
:type document_id: str
:return: A Document object containing the document details
:rtype: Document
- get_documents(self, collection_id: str, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None) -> gen_ai_hub.document_grounding.models.vector.DocumentsResponse
- Get documents from a collection.
:param collection_id: The ID of the collection to retrieve documents from.
:type collection_id: str
:param top: the number of documents to retrieve, defaults to None
:type top: Optional[int], optional
:param skip: the number of documents to skip, defaults to None
:type skip: Optional[int], optional
:param count: whether to include the total count of documents, defaults to None
:type count: Optional[bool], optional
:return: A DocumentsResponse object containing the list of documents
:rtype: DocumentsResponse
- search(self, request: gen_ai_hub.document_grounding.models.vector.TextSearchRequest) -> gen_ai_hub.document_grounding.models.vector.VectorSearchResults
- Perform semantic search in vector collections.
:param request: The object containing the search parameters.
:type request: TextSearchRequest
:return: A VectorSearchResults object containing the search results
:rtype: VectorSearchResults
- update_documents(self, collection_id: str, request: gen_ai_hub.document_grounding.models.vector.DocumentsUpdateRequest) -> gen_ai_hub.document_grounding.models.vector.DocumentsListResponse
- Update documents in a collection.
:param collection_id: The ID of the collection to update documents in.
:type collection_id: str
:param request: The object containing the documents to update.
:type request: DocumentsUpdateRequest
:return: A DocumentsListResponse object containing the updated documents
:rtype: DocumentsListResponse
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |