diff --git a/docs-java/orchestration/chat-completion.mdx b/docs-java/orchestration/chat-completion.mdx index 52276d3a9..7f7edc062 100644 --- a/docs-java/orchestration/chat-completion.mdx +++ b/docs-java/orchestration/chat-completion.mdx @@ -495,7 +495,7 @@ config = config.withStreamConfig( ## Using Images -It's possible to add images and multiple text inputs to a message. +It's possible to add images, files, and multiple text inputs to a message. ### Add Images to a Message @@ -521,6 +521,36 @@ var newMessage = message.withImage("https://url.to/image.jpg", ImageItem.DetailL Note, that currently only user messages are supported for image attachments. +### Add File Attachment to a Message + +A file can be added to a message either via a file path or via a base64 encoded string as follows. +Only PDF files are currently supported for file attachments. + +#### Add File via Local File Path + +```java +var message = Message.user("What is the title of the topic discussed here?"); +var newMessage = message.withFile(Path.of("path/to/sample.pdf")); +``` + +#### Add File via Remote File Path + +Filename is an optional parameter to the `withFileUrl` method shown below and could be set to null. + +```java +var message = Message.user("What is the title of the topic discussed here?"); +var newMessage = message.withFileUrl("https://somefile.pdf", "sample.pdf"); +``` + +#### Add File via Base64 Encoded String + +```java +var message = Message.user("What is the title of the topic discussed here?"); +var newMessage = message.withFileBase64(base64Data, "sample.pdf"); +``` + +Note, that currently only user messages are supported for file attachments. + ### Add Multiple Text Inputs to a Message It's also possible to add multiple text inputs to a message. @@ -623,7 +653,7 @@ Please find [an example in our Spring Boot application](https://github.com/SAP/a Translate the input or output to [any supported language](https://help.sap.com/docs/translation-hub/sap-translation-hub/supported-languages?version=Cloud#translation-provider-sap-machine-translation). The following sample will translate the prompt into English, send it to the LLM, and then translate the output to German. -Source Language is identified on the whole user input. +The source language is identified from the whole user input. ```java var prompt = new OrchestrationPrompt("Quelle est la couleur de la tour Eiffel?"); diff --git a/styles/config/vocabularies/SAP/accept.txt b/styles/config/vocabularies/SAP/accept.txt index 5dc569e77..fd9433a7f 100644 --- a/styles/config/vocabularies/SAP/accept.txt +++ b/styles/config/vocabularies/SAP/accept.txt @@ -83,6 +83,7 @@ www semver XML MDX +PDF classpath [Ss]ervlet [Aa]ccessor