Skip to content

Commit

Permalink
Merge pull request #158 from Joy-less/fix-156
Browse files Browse the repository at this point in the history
Rename Properties to Property
  • Loading branch information
awaescher authored Jan 3, 2025
2 parents d35387c + d8bb1b4 commit 2771cb0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions demo/Demos/ToolConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public WeatherTool()
Name = "get_current_weather",
Parameters = new Parameters
{
Properties = new Dictionary<string, Properties>
Properties = new Dictionary<string, Property>
{
["location"] = new() { Type = "string", Description = "The location to get the weather for, e.g. San Francisco, CA" },
["format"] = new() { Type = "string", Description = "The format to return the weather in, e.g. 'celsius' or 'fahrenheit'", Enum = ["celsius", "fahrenheit"] },
Expand All @@ -127,7 +127,7 @@ public NewsTool()
Name = "get_current_news",
Parameters = new Parameters
{
Properties = new Dictionary<string, Properties>
Properties = new Dictionary<string, Property>
{
["location"] = new() { Type = "string", Description = "The location to get the news for, e.g. San Francisco, CA" },
["category"] = new() { Type = "string", Description = "The optional category to filter the news, can be left empty to return all.", Enum = ["politics", "economy", "sports", "entertainment", "health", "technology", "science"] },
Expand Down
2 changes: 1 addition & 1 deletion src/MicrosoftAi/AbstractionMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static Tool ToOllamaSharpTool(AIFunctionMetadata functionMetadata)
Name = functionMetadata.Name,
Parameters = new Parameters
{
Properties = functionMetadata.Parameters.ToDictionary(p => p.Name, p => new Properties
Properties = functionMetadata.Parameters.ToDictionary(p => p.Name, p => new Models.Chat.Property
{
Description = p.Description,
Enum = GetPossibleValues(p.Schema as JsonObject),
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Chat/ChatRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public class Parameters
/// Gets or sets the properties of the parameters with their respective types and descriptions.
/// </summary>
[JsonPropertyName("properties")]
public Dictionary<string, Properties>? Properties { get; set; }
public Dictionary<string, Property>? Properties { get; set; }

/// <summary>
/// Gets or sets a list of required fields within the parameters.
Expand All @@ -136,7 +136,7 @@ public class Parameters
/// <summary>
/// Represents a property within a function's parameters, including its type, description, and possible values.
/// </summary>
public class Properties
public class Property
{
/// <summary>
/// Gets or sets the type of the property.
Expand Down
4 changes: 2 additions & 2 deletions test/OllamaApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public async Task Receives_Response_Message_With_ToolsCalls()
Name = "get_current_weather",
Parameters = new Parameters
{
Properties = new Dictionary<string, Properties>
Properties = new Dictionary<string, OllamaSharp.Models.Chat.Property>
{
["location"] = new()
{
Expand Down Expand Up @@ -493,7 +493,7 @@ public async Task Response_Streaming_Message_With_ToolsCalls_Throws_Not_Supporte
Name = "get_current_weather",
Parameters = new Parameters
{
Properties = new Dictionary<string, Properties>
Properties = new Dictionary<string, OllamaSharp.Models.Chat.Property>
{
["location"] = new()
{
Expand Down

0 comments on commit 2771cb0

Please sign in to comment.