Files
semantic-kernel/java/extensions
John OliverandRajasekar Elango aff5552977 Java: Apply ADR 008 (#3366)
Closed #2417 in favour of this PR which also includes @relango s
commits.

This PR updates for full support for ADR 008
(https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0008-support-generic-llm-request-settings.md),
which is the ADR in this area.

This PR does the following:
- Updates the code to support ADR 008.
- Apply code formatting needed on these
- If you dont want do do this PR via your branch I can PR it directly
and close this PR.

Now you can add serviceId and model to invocation, i.e:
``
Mono<SKContext> result = function.invokeAsync("time travel to dinosaur
age",
        SKBuilders
            .completionRequestSettings()
            .serviceId("text-davinci-003")
            .build());
``
function config, i.e:

```
    var function = kernel.
        getSemanticFunctionBuilder()
        .withPromptTemplate("tell a joke about {{$input}}")
        .withRequestSettings(
            SKBuilders.completionRequestSettings()
                .temperature(0.4)
                .topP(1)
                .maxTokens(100)
                .serviceId("text-davinci-003")
                .build())
        .build();
```

Or config file

```
{
  "schema": 1,
  "description": "Sample plugin with a model and service id",
  "type": "completion",
  "completion": {
    "max_tokens": 150,
    "temperature": 0.9,
    "top_p": 0.0,
    "presence_penalty": 0.6,
    "frequency_penalty": 0.0,
    "service_id": "text-davinci-003",
    "model_id": "text-davinci-003"
  }
}
```

---------

Co-authored-by: Rajasekar Elango <[email protected]>
2023-11-28 14:16:45 +00:00
..