mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
### Motivation and Context Please help reviewers and future users, providing the following information: 1. Why is this change required? Demonstrates how to call Semantic Kernel from Node ### Description First node-api-dotnet example showing how to invoke a semantic function ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
Semantic Kernel Node syntax examples
This project contains a collection of examples which demonstrate how to call the Semantic Kernel from a Node application.
The examples use node-api-dotnet. This project enables advanced interoperability between .NET and JavaScript in the same process.
To run the samples, first set the following environment variables referencing your Azure OpenAI deployment:
# Azure OpenAI
set AzureOpenAI__ServiceId=..
set AzureOpenAI__DeploymentName=text-davinci-003
set AzureOpenAI__Endpoint=https://... .openai.azure.com/
set AzureOpenAI__ApiKey=...
Then run the following commands in sequence:
# Install SemanticKernel nuget packages into the project and generate type definitions.
dotnet build
# Install node-api-dotnet npm package into the project.
npm install
# Run example JS code that uses the above packages to call the Azure OpenAI service.
node Example01_SummarizeText.js