Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions docs-java/ai-core/document-grounding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ You can use the grounding service via orchestration.
Please find the [Orchestration documentation on grounding](../orchestration/chat-completion.mdx#grounding).

```java
OrchestrationClient client;
OrchestrationClient client = new OrchestrationClient();

var databaseFilter =
DocumentGroundingFilter.create()
Expand All @@ -189,12 +189,10 @@ var configWithGrounding =

var inputParams = Map.of("query", "What is SAP Cloud SDK for AI?");

var prompt =
new OrchestrationPrompt(
inputParams,
Message.system("Context message with embedded grounding results. {{?results}}"));
var template = Grounding.createGroundingPrompt("{{?query}}").withInputParameters(inputParams);

OrchestrationChatResponse response = client.chatCompletion(prompt, configWithGrounding);
OrchestrationChatResponse response =
client.chatCompletion().config(configWithGrounding).promptTemplate(template).execute();
```

## Custom Headers
Expand Down
12 changes: 10 additions & 2 deletions docs-java/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ There is also a convenient method to add custom headers to single calls through

```java
var client = new OrchestrationClient();

var result = client.withHeader("my-header-key", "my-header-value").chatCompletion(prompt, config);
var config = new OrchestrationModuleConfig(OrchestrationAiModel.GPT_4O);
var template = PromptTemplate.create("Hello world!");

var result =
client
.withHeader("my-header-key", "my-header-value")
.chatCompletion()
.config(config)
.promptTemplate(template)
.execute();
```

For more information on this feature, see the respective documentation of the [OrchestrationClient](https://sap.github.io/ai-sdk/docs/java/orchestration/chat-completion#custom-headers) and [OpenAIClient](https://sap.github.io/ai-sdk/docs/java/foundation-models/openai/chat-completion#custom-headers).
Expand Down
11 changes: 7 additions & 4 deletions docs-java/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ Next, we'll specify the model we want to use:
var config = new OrchestrationModuleConfig(OrchestrationAiModel.GPT_4O);
```

Now we can create our first prompt:
Now we can create our first prompt template and execute the request:

```java
var prompt = new OrchestrationPrompt("Hello world! Why is this phrase so famous?");
LocalPromptTemplate template =
PromptTemplate.create("Hello world! Why is this phrase so famous?");

var result = client.chatCompletion(prompt, config).getContent();
String result =
client.chatCompletion().config(config).promptTemplate(template).execute().getContent();
```

The result will be the text generated by the AI model.
Expand All @@ -81,6 +83,7 @@ Please find **detailed instructions** and more examples [in this documentation](

### Explore Further Capabilities

Check out the options available for the `OrchestrationPrompt` and `OrchestrationModuleConfig` classes.
Check out the options available for the `PromptTemplate.create(...)` and the `OrchestrationModuleConfig` classes.
Templates hold messages, input parameters, and response formats, while the module configuration holds model and orchestration settings.
You can use templating, content filtering, data masking and more.
Please refer to [this documentation](orchestration/chat-completion.mdx) for more information.
Loading
Loading