Skip to content

Instantly share code, notes, and snippets.

@conwid
conwid / IniFormatter.cs
Last active May 16, 2023 14:37
More complete IFormatter implementation reference for students preparing for MS 70-483
public class IniFormatter : IFormatter
{
public class IniTypeBinder : SerializationBinder
{
public override Type BindToType(string assemblyName, string typeName) => Type.GetType(typeName.Split('=')[1]);
public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
{
assemblyName = $"{IniFormatter.AssemblyNameKey}={serializedType.Assembly.FullName}";
typeName = $"{IniFormatter.ClassNameKey}={serializedType.AssemblyQualifiedName}";
}
@conwid
conwid / 01 nuget packages
Created May 19, 2025 19:44
Gist created from visual studio extension
<ItemGroup>
<PackageReference Include="SmartComponents.AspNetCore" Version="0.1.0-preview10147" />
<PackageReference Include="SmartComponents.Inference.OpenAI" Version="0.1.0-preview10147" />
<PackageReference Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10147" />
</ItemGroup>
@conwid
conwid / 02 applymodel
Created May 19, 2025 19:48
Gist created from visual studio extension
public class ApplyModel
{
public string Name { get; set; }
public string Role { get; set; }
public string Credentials { get; set; }
}
@conwid
conwid / 03 editform
Created May 19, 2025 19:48
Gist created from visual studio extension
<EditForm Model="@applyModelSource" OnValidSubmit="SubmitAsync">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="form-group">
<InputText @bind-Value="applyModelSource.Name" />
</div>
<div class="form-group">
<InputText @bind-Value="applyModelSource.Role" />
</div>
@conwid
conwid / 01 service setup
Created May 19, 2025 19:49
Gist created from visual studio extension
builder.Services.AddSmartComponents()
.WithInferenceBackend<CustomInferenceBackend>()
.WithAntiforgeryValidation();
@conwid
conwid / 01 config
Created May 19, 2025 19:50
Gist created from visual studio extension
"SmartComponents": {
"ApiKey": "AWTI4Cdf1YIcfu7SgHbvKdfpmEQkWFs8d8C3lfHXaawAIqq1lXM9JQQJ99BEAC5RqLJXJ3w3AAABACOGMbXv",
"DeploymentName": "gpt-4.1-nano",
"Endpoint": "https://akos.openai.azure.com/"
}
@conwid
conwid / 04smartasteinference
Created May 19, 2025 19:55
Gist created from visual studio extension
public class CustomSmartPasteInference : SmartPasteInference
{
public override ChatParameters BuildPrompt(SmartPasteRequestData data)
{
var prompt = base.BuildPrompt(data);
return prompt;
}
}
@conwid
conwid / 04 smartpasteinput
Created May 19, 2025 19:56
Gist created from visual studio extension
Hi Gopas,
My name is Akos Nagy. I'm writing to apply for the role AI trainer. I have a master's degree in computer engineering from the Budapest Unviersity of technology and economics and have passed Microsoft AI-900 and AI-102.
@conwid
conwid / 05 smarttextarea
Created May 19, 2025 19:57
Gist created from visual studio extension
<SmartTextArea @bind-Value="@text" UserRole="@userRole" UserPhrases="@userPhrases"/>
@code {
private string? text;
private string userRole = "HR professional replying to applications for a role";
private string[] userPhrases = [
"Thank your for your interest in NEED_INFO",
"We have reviewed your application",
"Unfortunately we have decided not to move forward",
@conwid
conwid / 06smarttextinference
Created May 19, 2025 19:57
Gist created from visual studio extension
public class CustomSmartTextAreaInference : SmartTextAreaInference
{
public override ChatParameters BuildPrompt(
SmartTextAreaConfig config, string textBefore, string textAfter)
{
var prompt = base.BuildPrompt(config, textBefore, textAfter);
return prompt;
}
}