gen_ai_hub.document_grounding.clients.pipeline_api_client module¶
Pipeline API client for Document Grounding.
This module provides the PipelineAPIClient class for managing document vectorization pipelines. Pipelines automate the process of fetching documents from data repositories, preprocessing and chunking content, generating semantic embeddings, and storing them in HANA Vector Store.
- Supported data repositories:
Microsoft SharePoint
AWS S3
SFTP
API Reference: https://api.sap.com/api/DOCUMENT_GROUNDING_API/resource/Pipelines
- class gen_ai_hub.document_grounding.clients.pipeline_api_client.PipelineAPIClient(proxy_client: GenAIHubProxyClient | None = None)¶
Bases:
objectThe 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
- __init__(proxy_client: GenAIHubProxyClient | None = None)¶
Initializes the PipelineAPIClient
- Parameters:
proxy_client (Optional[GenAIHubProxyClient], optional) – proxy client to use for requests, defaults to None
- create_pipeline(pipeline_request: MSSharePointPipelineCreateRequest | S3PipelineCreateRequest | SFTPPipelineCreateRequest) PipelineIdResponse¶
Create a document vectorization pipeline
- Parameters:
pipeline_request (CreatePipelineRequest) – The object containing the pipeline configuration.
- Returns:
ID of the created pipeline
- Return type:
- get_pipelines(top: int | None = None, skip: int | None = None, count: bool | None = None) GetPipelinesResponse¶
Get all pipelines.
- Returns:
Get all pipelines
- Return type:
- get_pipeline_by_id(pipeline_id: str) BasePipelineResponse¶
Get details of a pipeline by pipeline id.
- Parameters:
pipeline_id (str) – Pipeline ID
- Returns:
Details of the pipeline
- Return type:
- delete_pipeline_by_id(pipeline_id: str) Response¶
Delete a pipeline by pipeline id
- Parameters:
pipeline_id (str) – ID of the pipeline to delete
- Returns:
Response of the delete operation
- Return type:
requests.Response
- get_pipeline_status(pipeline_id: str) GetPipelineStatusResponse¶
Get pipeline status by pipeline id
- Parameters:
pipeline_id (str) – Pipeline ID
- Returns:
Status of the pipeline
- Return type:
- search_pipelines(body: SearchPipelineRequest) SearchPipelinesResponse¶
Pipeline Search by Metadata
- Parameters:
body (SearchPipelineRequest) – The search request object containing metadata filters.
- Returns:
Search results containing matching pipelines.
- Return type:
- get_pipeline_executions(pipeline_id: str, last_execution: bool | None = None, top: int | None = None, skip: int | None = None, count: bool | None = None) GetPipelineExecutionsResponse¶
Get Pipeline Executions
- Parameters:
pipeline_id (str) – Pipeline ID
last_execution (Optional[bool], optional) – flag to get only the last execution, defaults to None
top (Optional[int], optional) – number of executions to retrieve, defaults to None
skip (Optional[int], optional) – number of executions to skip, defaults to None
count (Optional[bool], optional) – flag to include count of total executions, defaults to None
- Returns:
Pipeline Executions
- Return type:
- get_pipeline_execution_by_id(pipeline_id: str, execution_id: str) PipelineExecution¶
Get Pipeline Execution by ID
- Parameters:
pipeline_id (str) – Pipeline ID
execution_id (str) – Execution ID
- Returns:
Pipeline Execution
- Return type:
- get_execution_documents(pipeline_id: str, execution_id: str, top: int | None = None, skip: int | None = None, count: bool | None = None) DocumentsStatusResponse¶
Get Documents for a Pipeline Execution
- Parameters:
pipeline_id (str) – Pipeline ID
execution_id (str) – Execution ID
top (Optional[int], optional) – the maximum number of documents to return, defaults to None
skip (Optional[int], optional) – number of documents to skip, defaults to None
count (Optional[bool], optional) – flag to include count of total documents, defaults to None
- Returns:
Documents for the Pipeline Execution
- Return type:
- get_execution_document_by_id(pipeline_id: str, execution_id: str, document_id: str) Document¶
Get Document by ID for a Pipeline Execution
- Returns:
Document for the Pipeline Execution
- Return type:
- get_pipeline_documents(pipeline_id: str, top: int | None = None, skip: int | None = None, count: bool | None = None) DocumentsStatusResponse¶
Get Documents for a Pipeline
- Parameters:
pipeline_id (str) – Pipeline ID
top (Optional[int], optional) – the maximum number of documents to return, defaults to None
skip (Optional[int], optional) – number of documents to skip, defaults to None
count (Optional[bool], optional) – flag to include count of total documents, defaults to None
- Returns:
Documents for the Pipeline
- Return type:
- get_pipeline_document_by_id(pipeline_id: str, document_id: str) Document¶
Get Document by ID for a Pipeline
- Parameters:
pipeline_id (str) – Pipeline ID
document_id (str) – Document ID
- Returns:
Document for the Pipeline
- Return type:
- trigger_pipeline(request: ManualPipelineTrigger) Response¶
Trigger Pipeline Manually
- Parameters:
request (ManualPipelineTrigger) – The manual trigger request object.
- Returns:
Response of the trigger operation
- Return type:
requests.Response