Giter Site home page Giter Site logo

semantic-kernel-starters's Introduction

Semantic Kernel Starters

This repository contains starter projects for the Semantic Kernel. Each starter is a self-contained application using a different programming language and application runtime.

Usage

  • git clone https://github.com/microsoft/semantic-kernel-starters
  • code <any-sample-folder>
  • Follow the instructions in each sample's README for setting up and running the sample Alternatively, you can use the Semantic Kernel Tools to "Create a New App" using the starters

Getting Started

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

semantic-kernel-starters's People

Contributors

careywalker-msft avatar dependabot[bot] avatar dmytrostruk avatar eric-urban avatar hario90 avatar ivatilca avatar janemmanueltgo avatar m-v-k avatar markwallace-microsoft avatar matthewbolanos avatar microsoft-github-operations[bot] avatar microsoftopensource avatar milderhc avatar mkarle avatar raffertyuy avatar roybott avatar sgoings avatar shawncal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semantic-kernel-starters's Issues

Python `hello world` does not work

Describe the bug
There are two issues:

  1. Call to non-existing function import_semantic_skill_from_directory
  2. Depricated model text-davinci-003

To Reproduce
Steps to reproduce the behavior:

  1. Run the example

Expected behavior
Should generate some output

Desktop (please complete the following information):
All

Additional context
Add any other context about the problem here.

MethodNotFound Exception when executing IChatCompletion.GetChatCompletionsAsync()

Describe the bug
I'm getting a "MethodNotFound" Exception when executing IChatCompletion.GetChatCompletionsAsync(). The Error:
Method not found: 'System.Threading.Tasks.Task1<Azure.Response1<Azure.AI.OpenAI.ChatCompletions>> Azure.AI.OpenAI.OpenAIClient.GetChatCompletionsAsync(System.String, Azure.AI.OpenAI.ChatCompletionsOptions, System.Threading.CancellationToken)'.

To Reproduce
Steps to reproduce the behavior: Starting a Blazor Project with the following setup. I put a test for AzureOpenAI chat access in (which works without issues) and below I'm trying the same with the semantic kernel approach. I just put them in the Program.cs file to keep the example short.

using GaGSemanticMap.Components;
using DotNetEnv;
using Azure.AI.OpenAI;
using Azure;
using GaGSemanticMap.Services;
using GaGSemanticMap.Skills;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.AI.OpenAI;

var builder = WebApplication.CreateBuilder(args);

Env.Load();

string key = Environment.GetEnvironmentVariable("KEY");
string endPoint = Environment.GetEnvironmentVariable("ENDPOINT");
string model = Environment.GetEnvironmentVariable("MODEL");
string embeddingModel = Environment.GetEnvironmentVariable("EMBEDDING");

//todo: implement a logger

//add configs
/*builder.Configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", true, true)
    .AddEnvironmentVariables()
    .AddUserSecrets<Program>(); */

// register services
builder.Services.AddRazorComponents()
    .AddInteractiveServerComponents();

builder.Services.AddLogging();
builder.Logging.SetMinimumLevel(LogLevel.Warning);


//test for azure openai client
var client = new OpenAIClient(new Uri(endPoint!), new AzureKeyCredential(key));

var chatCompletionsOptions = new ChatCompletionsOptions()
{
	Messages =
			{
                //new ChatMessage(ChatRole.System, "You are an unhelpful assistant, getting sassy when you have to answer a question"),
                new Azure.AI.OpenAI.ChatMessage(ChatRole.System, "You speak like Yoda and give wise advice"),
				new Azure.AI.OpenAI.ChatMessage(ChatRole.User, "this is the way!")
			},
	MaxTokens = 400,
	DeploymentName = model

};
Response<ChatCompletions> response = await client.GetChatCompletionsAsync(chatCompletionsOptions);
var botResponse = response.Value.Choices.First().Message.Content;



//initiate kernel
var kernelBuilder = new KernelBuilder();
kernelBuilder.WithAzureOpenAIChatCompletionService(model, client);
//kernelBuilder.WithAzureOpenAITextEmbeddingGenerationService(embeddingModel, endPoint!, key);
IKernel kernel = kernelBuilder.Build();
builder.Services.AddSingleton(kernel);


//testing the kernel
var chatRequestSettings = new OpenAIRequestSettings()
{
	MaxTokens = 500,
	Temperature = 0.0f,
	FrequencyPenalty = 0.0f,
	PresencePenalty = 0.0f,
	TopP = 0.0f
};
var chatCompletion = kernel.GetService<IChatCompletion>();

var prompt = "You are a helpful AI";

var chatHistory = chatCompletion.CreateNewChat(prompt);

chatHistory.AddUserMessage("Hey how are you?");

//this line throws the error
var result = chatCompletion.GetChatCompletionsAsync(chatHistory, chatRequestSettings).GetAwaiter().GetResult();


var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error", createScopeForErrors: true);
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode();

app.Run();

Expected behavior
Return of the message of the configured chat.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10

ProjectInfo

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Azure.AI.OpenAI" Version="1.0.0-beta.9" />
    <PackageReference Include="DotNetEnv" Version="2.5.0" />
    <PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta8" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="Pgvector" Version="0.2.0-rc.2" />
    <PackageReference Include="Pgvector.EntityFrameworkCore" Version="0.2.0-rc.1" />
  </ItemGroup>

</Project>

ServiceId (or deploymentId) is being prepended to the assistant response after few turns running out of the box hello world c-sharp project

Describe the bug
Hello world C-Sharp project will show service Id (or deployment Id) as part of assistant response after few turns

To Reproduce
Steps to reproduce the behavior:

  1. Configure and run sk-csharp-hello-world project with Azure OpenAI gpt-35-turbo model
  2. After Few turns of natural conversation (4 or 5 turns) service Id (or deployment Id) will be displayed
    e.g. : Assistant > gpt-35-turboThank you! If you have any more questions ...

Expected behavior
Should not show service Id (or deployment Id)

Screenshots
User > hi
Assistant > Hello! How can I assist you today?
User > what can you do?
Assistant > I can help you with a variety of tasks. Here are some things I can do:

  1. Answer questions: I can provide information on a wide range of topics.
  2. Provide recommendations: If you need suggestions for movies, books, restaurants, or anything else, I can help.
  3. Set reminders: I can help you remember important dates and events.
  4. Perform calculations: If you need help with math problems or conversions, I can assist you.
  5. Language translation: I can translate phrases or sentences between different languages.
  6. Weather information: I can provide current weather conditions and forecasts for any location.
  7. Play games: I can play simple text-based games with you.

Please let me know how I can assist you further!
User > nice
Assistant > gpt-35-turboThank you! I'm here to help, so if you have any questions or need assistance with anything specific, feel free to ask.

Desktop (please complete the following information):

  • OS: MacOS 14.1.2 M3-Max (
  • IDE: VSCode
  • NuGet Package Version: 1.0.0-rc3

Additional context
Could not test it with other models

In the starter Kit the file name is : AiPluginJson.cs and not appsettings.cs

Describe the bug
A clear and concise description of what the bug is.

In the starter Kit the file name is : AiPluginJson.cs and not appsettings.cs

To Reproduce
Steps to reproduce the behavior:

  1. Go to '(https://learn.microsoft.com/en-us/semantic-kernel/ai-orchestration/chatgpt-plugins#:~:text=Open%20the%20appsettings.cs%20file.)'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows]
  • IDE: [e.g. Visual Studio, VS Code]
  • NuGet Package Version [e.g. 0.1.0]

Additional context
Add any other context about the problem here.

Repo upgrade

Hello,
Since the https://github.com/microsoft/chat-copilot repo is upgraded to SK V1.4, this repo also needs upgrade (the sk-csharp-chatgpt-plugin project can be tested with chat-copilot).
All the starter projects are outdated, they're left back in .NET 6 and have references to preview version packages.
Are there any future updates or roadmap items that you are considering at the moment?
Thanks

Tasks

No tasks being tracked yet.

sk-csharp-hello-world starter project doesn't build and run in VSCode

Describe the bug
Using the Get Started link from the SK Tools in VSCode, I created a new app and selected Console Chat. This got the required files for running the sk-csharp-hello-world starter project but hitting F5 fails due to the tasks.json referencing sk-csharp-hello-world.sln which does not exist.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Helpful Links -> Get Started from the Semantic Kernal VSCode Extension
  2. Click on 'Create a new App'
image
  1. Select 'C# Console App' (select a folder and let it setup the files)
  2. Hit F5 to build, run, debug the app
  3. See error in terminal:

MSBUILD : error MSB1009: Project file does not exist.
Switch: C:\Dev\SK\Scratch\ConsoleChat\sk-csharp-console-chat/sk-csharp-console-chat.sln

Expected behavior
App should build, run and enter debug

Desktop (please complete the following information):

  • OS: Windows
  • IDE: VS Code

Additional context
This can be fixed by editing the tasks.json to reference the sk-csharp-hello-world.proj project file rather than the sln file that doesn't exist.

I will open a PR to address this soon.

Error on Prompt Entered

Describe the bug
I get the following error after setting up and running the csharp 'Hello World' app for the first time:

Exception has occurred: CLR/Microsoft.SemanticKernel.Http.HttpOperationException
An exception of type 'Microsoft.SemanticKernel.Http.HttpOperationException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Unrecognized request argument supplied: functions
Status: 404 (model_error)

Content:
{
"error": {
"message": "Unrecognized request argument supplied: functions",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

Headers:
Access-Control-Allow-Origin: REDACTED
x-ms-region: REDACTED
x-ratelimit-remaining-tokens: REDACTED
apim-request-id: REDACTED
X-Request-ID: REDACTED
ms-azureml-model-error-reason: REDACTED
ms-azureml-model-error-statuscode: REDACTED
x-ms-client-request-id: 55d2f70c-33d7-4c7e-a003-0332edeb6f88
x-ratelimit-remaining-requests: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Fri, 08 Dec 2023 22:11:36 GMT
Content-Length: 162
Content-Type: application/json'
Inner exceptions found, see $exception in variables window for more details.
Innermost exception Azure.RequestFailedException : Unrecognized request argument supplied: functions
Status: 404 (model_error)

Content:
{
"error": {
"message": "Unrecognized request argument supplied: functions",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

Headers:
Access-Control-Allow-Origin: REDACTED
x-ms-region: REDACTED
x-ratelimit-remaining-tokens: REDACTED
apim-request-id: REDACTED
X-Request-ID: REDACTED
ms-azureml-model-error-reason: REDACTED
ms-azureml-model-error-statuscode: REDACTED
x-ms-client-request-id: 55d2f70c-33d7-4c7e-a003-0332edeb6f88
x-ratelimit-remaining-requests: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Fri, 08 Dec 2023 22:11:36 GMT
Content-Length: 162
Content-Type: application/json
at Azure.Core.HttpPipelineExtensions.d__0.MoveNext()
at System.Threading.Tasks.ValueTask1.get_Result() at Azure.AI.OpenAI.OpenAIClient.<GetChatCompletionsStreamingAsync>d__16.MoveNext() at Microsoft.SemanticKernel.Connectors.AI.OpenAI.ClientCore.<RunRequestAsync>d__361.MoveNext()

To Reproduce
Steps to reproduce the behavior:
Follow along with the readme and run the app, when prompted, I typed
User > Hello

Desktop (please complete the following information):
OS: Windows 10.0.19045
IDE: VSCode
NuGet Package Version: 1.0.0-rc3

Additional context
Completed test with GPT-35-turbo deployed in Azure OpenAI

The error causes a break to happen at line 49 of Program.cs

Azure Function Authentication

Describe the bug
Need advice on how to enable Azure Function Authentication for ChatGPT Plugins

To Reproduce
Once Azure Function authentication is turned on, function keys need to be sent with every request
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req)
Semantic Kernel does not send the function key, so it is unable to call the function

Expected behavior
A way to enable function keys to work with Semantic Kernel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.