Skip to content

Instantly share code, notes, and snippets.

View xximjasonxx's full-sized avatar

Jason Farrell xximjasonxx

View GitHub Profile
--- config.json
{
"schema": 1,
"description": "Given a by category request for a time range, format the resulting monetary value",
"execution_settings": {
"default": {
"max_tokens": 70,
"temperature": 0.9,
"top_p": 0.0,
"presence_penalty": 0.0,
public sealed class CosmosPlugin
{
private readonly IConfiguration _configuration;
public CosmosPlugin(IConfiguration configuration)
{
_configuration = configuration;
}
[KernelFunction("byCategoryInDateRange")]
var builder = Kernel.CreateBuilder();
builder.Plugins.AddFromType<MathPlugin>();
builder.Plugins.AddFromPromptDirectory(Path.Combine(Directory.GetCurrentDirectory(), "Plugins", "GenStatementPlugin"));
builder.AddAzureOpenAIChatCompletion("<deployment name>", "<endpoint>", "<key>");
var kernel = builder.Build();
WRITE EXACTLY ONE STATEMENT USING THE NUMBER BELOW ABOUT ANY TOPIC.
STATEMENT MUST BE:
- G RATED
- WORKPLACE/FAMILY SAFE
NO SEXISM, RACISM OR OTHER BIAS/BIGOTRY.
BE CREATIVE AND FUNNY. I WANT TO BE AMUSED.
+++++
{{$number}}
+++++
{
"schema": 1,
"description": "Generate a statement that uses the provided number in that statement",
"execution_settings": {
"default": {
"max_tokens": 70,
"temperature": 0.9,
"top_p": 0.0,
"presence_penalty": 0.0,
"frequency_penalty": 0.0
var builder = Kernel.CreateBuilder();
builder.Plugins.AddFromType<MathPlugin>();
builder.AddAzureOpenAIChatCompletion("<deployment name>", "<endpoint>", "<key>");
var kernel = builder.Build();
#pragma warning disable // Suppress the diagnostic messages
var planner = new HandlebarsPlanner(new HandlebarsPlannerOptions() { AllowLoops = true });
var plan = await planner.CreatePlanAsync(kernel, $"Get the result of subtracting 10 from the sum of factorials {numberOne} and {numberTwo}");
var builder = Kernel.CreateBuilder();
builder.Plugins.AddFromType<MathPlugin>();
builder.AddAzureOpenAIChatCompletion(
"<deploymentname>",
"<open ai instance endpoint>",
"<api key>");
using System.ComponentModel;
using Microsoft.SemanticKernel;
namespace FactorialAdder.Plugins
{
public sealed class MathPlugin
{
[KernelFunction("factorial"), Description("Calculates the factorial of a number")]
public static int Factorial(
int numberOne = int.Parse(args[0]);
int numberTwo = int.Parse(args[1]);
var builder = Kernel.CreateBuilder();
builder.Plugins.AddFromType<MathPlugin>();
var kernel = builder.Build();
var result = await kernel.InvokeAsync<int>("MathPlugin", "factorial", new() { { "number", numberOne } });
Console.WriteLine(result);
using System.ComponentModel;
using Microsoft.SemanticKernel;
namespace FactorialAdder.Plugins
{
public sealed class MathPlugin
{
[KernelFunction("factorial"), Description("Calculates the factorial of a number")]
public static int Factorial(