Skip to content

Files

Latest commit

1607033 · Apr 23, 2025

History

History

sk-typescript-console-chat

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 15, 2023
Sep 15, 2023
Sep 15, 2023
Sep 15, 2023
Sep 15, 2023
Sep 15, 2023
Sep 15, 2023
Apr 23, 2025
Sep 15, 2023

Example: Using .NET Semantic Kernel to call Azure OpenAI

The consoleChat.js script dynamically loads the Microsoft.SemanticKernel .NET assembly and uses it to call Azure OpenAI.

This application allows you to have a conversation with Azure OpenAI. It will ask you to enter your question and return the response. You can continue the conversation by entering another question. When finished, type goodbye to end the conversation.

To run this example, first set the following environment variables, as System variables, referencing your Azure OpenAI deployment:

  • OPENAI_ENDPOINT
  • OPENAI_DEPLOYMENT
  • OPENAI_KEY

Then run the following commands in sequence:

Command Explanation
dotnet build Install SemanticKernel nuget packages into the project and generate type definitions.
npm install Install node-api-dotnet npm package into the project.
npm run build Transpile the typescript to javascript.
node consoleChat.js Run consoleChat JS code that uses the above packages to call the Azure OpenAI service.