Semantic Kernel (SK) is a lightweight SDK that lets you easily mix conventional programming languages with the latest in Large Language Model (LLM) AI "prompts" with templating, chaining, and planning capabilities out-of-the-box.
To learn more about Microsoft Semantic Kernel, visit the Microsoft Semantic Kernel documentation.
The Semantic Kernel for Java is an SDK that implements the key concepts of the Semantic Kernel in Java. It is designed to be used in Java applications and services in an idiomatic way, and to be easily integrated with other Java libraries and frameworks.
To run the LLM prompts and semantic functions in this kernel, make sure you have an Open AI API Key or Azure Open AI service key.
To build the project, you will need to have:
The Semantic Kernel is built using Apache Maven.
-
Clone this repository
git clone git@github.com:microsoft/semantic-kernel.git
-
Build the Semantic Kernel
cd semantic-kernel/java mvnw install
- Note: by defautlt, certain tests will not run if an OpenAI key is not set
Check the ../samples
folder for examples.
Join the Microsoft Semantic Kernel Discord community to discuss the Semantic Kernel
and get help from the community. We have a #java
channel for Java-specific questions.
The project may contain integration tests that require an OpenAI key to run. To run the integration tests locally, you will need to set the following environment variable:
OPENAI_API_KEY
- the OpenAI API key.
If you are using Azure OpenAI, you will also need to set the following environment variables:
AZURE_OPENAI_ENDPOINT
- the Azure OpenAI endpoint found in Keys * Endpoint section of the Azure OpenAI service.AZURE_OPENAI_API_KEY
- the Azure OpoenAI API key found in Keys * Endpoint section of the Azure OpenAI service.AZURE_OPENAI_DEPLOYMENT_NAME
- the custom name you chose for your deployment when you deployed a model. It can be found under Resource Management > Deployments in the Azure Portal.
For more information, see the Azure OpenAI documentation on how to get your Azure OpenAI credentials.
To run the unit tests only, run the following command:
mvn package
To run all tests, including integration tests that require an OpenAI key, run the following command:
mvn verify
Before submitting a pull request, please make sure that you have run the project with the command:
./mvnw clean package -Pbug-check
The bug-check profile will detect some static analysis issues that will prevent merging as well as apply formatting requirements to the code base.
Also ensure that:
- All new code is covered by unit tests
- All new code is covered by integration tests
Once your proposal is ready, submit a pull request to the main
branch. The pull request will be reviewed by the
project maintainers.
Make sure your pull request has an objective title and a clear description explaining the problem and solution.
This project is licensed under the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct.