diff --git a/docs-java/ai-core/document-grounding.mdx b/docs-java/ai-core/document-grounding.mdx index d94806413..f706f66df 100644 --- a/docs-java/ai-core/document-grounding.mdx +++ b/docs-java/ai-core/document-grounding.mdx @@ -17,9 +17,10 @@ This guide provides examples on how to manage data in [SAP Document Grounding](h It's divided into two main sections: Data Ingestion and Data Retrieval. :::warning -All classes under any of the `...model` packages are generated from an OpenAPI specification. -This means that these model classes are not guaranteed to be stable and may change with future releases. -They are safe to use, but may require updates even in minor releases. +All classes in the `...model` and `...client` packages are generated from an OpenAPI specification. +These classes can be used, but no API stability guarantees are provided, even for minor releases. +Maintenance and support are limited to ensuring consistency with the service specification. +No additional convenience API layer is provided. ::: ## Prerequisites @@ -78,6 +79,23 @@ PipelineStatus status = api.getPipelineStatus(resourceGroupId, pipeline.getPipel ### Vector API +Collection creation: + +``` +String resourceGroupId; +CollectionRequest collectionRequest; + +var api = new GroundingClient().vector(); + +OpenApiResponse documents = api.createCollection(resourceGroupId, collectionRequest); +Map> headers = documents.getHeaders(); + +String locationHeader = headers.get("Location").get(0); +String collectionId = locationHeader.replaceAll("^.*?/([a-f0-9-]+)/.*?$", "$1"); +``` + +Document creation: + ```java var api = new GroundingClient().vector(); var resourceGroupId = "default"; @@ -96,6 +114,23 @@ var request = DocumentCreateRequest.create() DocumentsListResponse response = api.createDocuments(resourceGroupId, collectionId, request); ``` +Document search: + +```java +String resourceGroup; +TextSearchRequest textSearch; + +var api = new GroundingClient().vector(); +var result = api.search(resourceGroup, textSearch); + +String joinedContent = result.getResults().stream() + .flatMap(r -> r.getResults().stream()) + .flatMap(r -> r.getDocuments().stream()) + .flatMap(d -> d.getChunks().stream()) + .map(VectorChunk::getContent) + .collect(Collectors.joining()); +``` + Refer to the [GroundingController](https://github.com/SAP/ai-sdk-java/tree/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java) in our Spring Boot application for a complete example. ## Data Retrieval diff --git a/docs-java/ai-core/prompt-registry.mdx b/docs-java/ai-core/prompt-registry.mdx index ddbc58839..7a5039766 100644 --- a/docs-java/ai-core/prompt-registry.mdx +++ b/docs-java/ai-core/prompt-registry.mdx @@ -16,9 +16,10 @@ keywords: This guide provides examples on how to manage the life cycle of your prompts, from design to runtime in [Prompt Registry](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/prompt-registry). :::warning -All classes under any of the `...model` packages are generated from an OpenAPI specification. -This means that these model classes are not guaranteed to be stable and may change with future releases. -They are safe to use, but may require updates even in minor releases. +All classes in the `...model` and `...client` packages are generated from an OpenAPI specification. +These classes can be used, but no API stability guarantees are provided, even for minor releases. +Maintenance and support are limited to ensuring consistency with the service specification. +No additional convenience API layer is provided. ::: ## Prerequisites