Files
semantic-kernel/java/samples
1714c25ebe Add settings retrieval through properties file and env vars (#1361)
### Motivation and Context

Add settings retrieval through properties file and env vars

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

Adds util.Settings to load settings values from a properties file or
from the environment.

Also, the ability to have different client settings in the properties
file and load them by their specific schema Id:
```yaml
client.azureopenai.key: "AZURE_OPEN_AI_KEY"
client.azureopenai.endpoint: "AZURE_OPEN_AI_ENDPOINT"
client.azureopenai.deploymentname: "AZURE_OPEN_AI_DEPLOYMENT_NAME"

client.myazureopenai.key: "AZURE_OPEN_AI_KEY"
client.myazureopenai.endpoint: "AZURE_OPEN_AI_ENDPOINT"
client.myazureopenai.deploymentname: "AZURE_OPEN_AI_DEPLOYMENT_NAME"
```

By calling `Settings.getAzureOpenAISettingsFromFile(CONF_PROPERTIES)`
the user would be able to load the Azure settings using the default
schema id, as shown in the block at the top.

By calling `Settings.getAzureOpenAISettingsFromFile(CONF_PROPERTIES,
"myazureopenai")` the user would be able to load a different Azure
configuration by just adding the second block to the properties file.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [ ] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Luigi Montoya <[email protected]>
Co-authored-by: joe-braley <[email protected]>
Co-authored-by: Luigi96 <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
Co-authored-by: John Oliver <[email protected]>
Co-authored-by: David Grieve <[email protected]>
2023-06-07 18:54:36 +01:00
..