This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- task: SonarQubePrepare@6 | |
inputs: | |
SonarQube: 'SonarQubeEndpoint-SNapp2' | |
scannerMode: 'MSBuild' | |
projectKey: 'SNapp2_SNapp2_c81c7b03-1b40-4b55-bcd0-5ad7541f2cb6' | |
projectName: 'SNapp2SonarQube' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Check the latest message to see if a tool was called | |
foreach (var toolCall in chat.Messages.Last().ToolCalls) | |
{ | |
if (toolCall.Function.Name == nameof(GetWeather)) | |
Console.WriteLine(GetWeather(toolCall.Function.Arguments["location"], toolCall.Function.Arguments["format"])); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uri = new Uri("http://localhost:11434"); //Default Ollama endpoint | |
var ollama = new OllamaApiClient(uri); | |
ollama.SelectedModel = "llama3.1:latest"; | |
string GetWeather(string location, string format) | |
{ | |
//Call the weather API here | |
return $"The weather in {location} is 25 degrees {format}"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tool = new Tool() | |
{ | |
Function = new Function | |
{ | |
Description = "Get the current weather for a location", | |
Name = "GetWeather", | |
Parameters = new Parameters | |
{ | |
Properties = new Dictionary<string, Properties> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chat = new Chat(ollama); | |
while (true) | |
{ | |
Console.Write("User>"); | |
var message = Console.ReadLine(); | |
Console.Write("Assistant>"); | |
await foreach (var answerToken in chat.Send(message)) | |
Console.Write(answerToken); | |
Console.WriteLine(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using OllamaSharp; | |
var uri = new Uri("http://localhost:11434"); //Default Ollama endpoint | |
var ollama = new OllamaApiClient(uri); | |
ollama.SelectedModel = "phi3.5:latest"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if PLATTELANDSLOKET | |
public Guid Id { get; init; } | |
#else | |
public int Id { get; init; } | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |
<DefineConstants>$(DefineConstants);PLATTELANDSLOKET</DefineConstants> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | |
<DefineConstants>$(DefineConstants);PLATTELANDSLOKET</DefineConstants> | |
</PropertyGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PLATTELANDSLOKET | |
#if PLATTELANDSLOKET | |
public Guid Id { get; init; } | |
#else | |
public int Id { get; init; } | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
#if DEBUG | |
Console.WriteLine("Debug mode is enabled."); | |
#else | |
Console.WriteLine("Release mode. Go go go!"); | |
#endif | |
} |
NewerOlder