| | |
- builtins.object
-
- VectorAPIClient
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)
| |