Skip to content

Commit 7f70a46

Browse files
committed
Add documentation
1 parent ee5458c commit 7f70a46

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/guides/ORCHESTRATION_CHAT_COMPLETION.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,37 @@ var result =
186186

187187
In this example, the input will be masked before the call to the LLM and will remain masked in the output.
188188

189+
### Grounding
190+
191+
Use the grounding module to provide additional context to the AI model.
192+
193+
```java
194+
var message =
195+
Message.user(
196+
"{{?groundingInput}} Use the following information as additional context: {{?groundingOutput}}");
197+
var prompt =
198+
new OrchestrationPrompt(Map.of("groundingInput", "What does Joule do?"), message);
199+
200+
var filterInner =
201+
DocumentGroundingFilter.create().id("someID").dataRepositoryType(DataRepositoryType.VECTOR);
202+
var groundingConfigConfig =
203+
GroundingModuleConfigConfig.create()
204+
.inputParams(List.of("groundingInput"))
205+
.outputParam("groundingOutput");
206+
groundingConfigConfig.setFilters(List.of(filterInner));
207+
208+
var groundingConfig =
209+
GroundingModuleConfig.create()
210+
.type(GroundingModuleConfig.TypeEnum.DOCUMENT_GROUNDING_SERVICE)
211+
.config(groundingConfigConfig);
212+
var configWithGrounding = config.withGroundingConfig(groundingConfig);
213+
214+
var result =
215+
new OrchestrationClient().chatCompletion(prompt, configWithGrounding);
216+
```
217+
218+
In this example, the AI model is provided with additional context in the form of grounding information. Note, that it is necessary to provide the grounding information in the user message.
219+
189220
### Set model parameters
190221

191222
Change your LLM configuration to add model parameters:

0 commit comments

Comments
 (0)