Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="Betalgo.OpenAI" Version="8.1.0" />
<PackageReference Include="Betalgo.OpenAI.Utilities" Version="8.0.1" />
<PackageReference Include="OpenAI" Version="2.10.0" />
<PackageReference Include="CsvHelper" Version="31.0.4" />
<PackageReference Include="dotNetRdf" Version="3.3.2" />
<PackageReference Include="ExtendedXmlSerializer" Version="3.7.18" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using OpenAI.ObjectModels;
using System.Threading;
using OpenAI.Utilities.FunctionCalling;
using Newtonsoft.Json;
using static System.Runtime.InteropServices.JavaScript.JSType;
using Argumentum.AssetConverter.Entities;
using Argumentum.AssetConverter.Mindmapper;

Expand All @@ -32,7 +29,7 @@ public class DatasetUpdaterConfig

public string OpenAIKeyPath { get; set; } = @"G:\Mon Drive\MyIA\Argumentum\Fallacies\Gestion\OpenAI-Key.txt";

public string Model { get; set; } = Models.Gpt_4_1106_preview;
public string Model { get; set; } = "gpt-4.1";

public int MaxTokensPerMinute { get; set; } = 70000;

Expand Down Expand Up @@ -486,7 +483,7 @@ private async Task DoChatGPTCall(CancellationToken ct, List<Dictionary<string, o
PrimaryKeyField = PrimaryField,
Records = recordGroup
};
dataPrompt.Functions = FunctionCallingHelper.GetToolDefinitions<RecordsUpdater>().Select(definition => (definition.Function, (object)recordsUpdator)).ToList();
dataPrompt.Functions = GetRecordsUpdaterToolDefinitions(recordsUpdator);
if (!string.IsNullOrEmpty(FunctionName))
{
dataPrompt.FunctionName = FunctionName;
Expand Down Expand Up @@ -531,4 +528,26 @@ private async Task DoChatGPTCall(CancellationToken ct, List<Dictionary<string, o
Logger.Log("Operation cancelled by user.");
}
}

private static List<FunctionToolDef> GetRecordsUpdaterToolDefinitions(RecordsUpdater recordsUpdater)
{
var toolDef = new FunctionToolDef(
name: "UpdateRecord",
description: "Updates a record's field given its primary key, the field's name and the new value for that field, returns both values separated by a line",
methodName: "UpdateRecord",
parametersJson: """
{
"type": "object",
"properties": {
"primaryKey": { "type": "string", "description": "The primary key value of the record to update" },
"fieldName": { "type": "string", "description": "The name of the field to update" },
"newValue": { "type": "string", "description": "The new value for the field" }
},
"required": ["primaryKey", "fieldName", "newValue"]
}
"""
);
toolDef.TargetObject = recordsUpdater;
return new List<FunctionToolDef> { toolDef };
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using OpenAI.ObjectModels;

namespace Argumentum.AssetConverter.DatasetUpdater;

Expand Down Expand Up @@ -58,7 +57,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "VirtuesJsonPromptSampleAssistant.json"
}
},
Model = Models.Gpt_3_5_Turbo_1106,
Model = "gpt-4.1-mini",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.SequentialChunks,
ChunkSize = 3,
Expand Down Expand Up @@ -113,7 +112,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptInstructionsAssistantDescription.txt"
}
},
Model = Models.Gpt_4_1106_preview,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.PKHierarchicalChar,
PKHierarchyLevel = 3,
Expand Down Expand Up @@ -177,7 +176,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptInstructionsLightAssistantExamples.txt"
}
},
Model = Models.Gpt_4_0125_preview,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.PKHierarchicalChar,
PKHierarchyLevel = 3,
Expand Down Expand Up @@ -240,7 +239,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptTranslateFrEnInstructionsAssistant.txt"
}
},
Model = Models.Gpt_4_0125_preview,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.PKHierarchicalChar,
PKHierarchyLevel = 3,
Expand Down Expand Up @@ -302,7 +301,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptTranslateRuInstructionsAssistant.txt"
}
},
Model = Models.Gpt_4_0125_preview,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.SequentialChunks,
PKHierarchyLevel = 3,
Expand Down Expand Up @@ -365,7 +364,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptTranslatePtInstructionsAssistant.txt"
}
},
Model = Models.Gpt_4_0125_preview,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.SequentialChunks,
PKHierarchyLevel = 3,
Expand Down Expand Up @@ -437,7 +436,7 @@ public async Task Apply(AssetConverterConfig config)
AssistantAnswerPath = PromptsRootPath + "PromptTranslateCleanupInstructionsAssistant.txt"
}
},
Model = Models.Gpt_4_turbo,
Model = "gpt-4.1",
MaxTokensPerMinute = 70000,
DivisionMode = DivisionMode.SequentialChunks,
PKHierarchyLevel = 3,
Expand Down
Loading