Description
Context / Scenario
below is the code to initiate local GPT with RAG
OllamaConfig ollamaConfig = new OllamaConfig()
{
TextModel = new OllamaModelConfig("mistral:latest") { MaxTokenTotal = 125000, Seed = 42, TopK = 6 },
EmbeddingModel = new OllamaModelConfig("nomic-embed-text:latest") { MaxTokenTotal = 2048 },
Endpoint = "http://localhost:11434/"
};
var memoryBuilder = new KernelMemoryBuilder()
.WithOllamaTextGeneration(ollamaConfig)
.WithOllamaTextEmbeddingGeneration(ollamaConfig);
memory = memoryBuilder.Build();
var desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var folderPath = System.IO.Path.Combine(desktopPath, "RAGDOC");
if (Directory.Exists(folderPath))
{
var textFiles = Directory.GetFiles(folderPath, "*.json");
var importTasks = textFiles.Select(async filePath =>
{
try
{
await memory.ImportDocumentAsync(filePath);
}
catch (Exception ex)
{
Console.Error.WriteLine($"Error importing {filePath} : {ex.Message}");
}
} );
await Task.WhenAll( importTasks );
}
below is a template for Json files imported
{
"title": "App Name",
"sections": [
{
"name": "Installation",
"chunks": [
{"subSection": "Step-by-Step Guide",
"content": "Detailed installation instructions for installation: Step 1, Step 2, etc.",
"tags": ["App", "installation", "setup"]}
]
},
{
"name": "Change Password",
"chunks": [
{"subSection": "Procedure",
"content": "Detailed steps on how to change your App password.",
"tags": ["App", "change password", "procedure"]}
]
}
]
}
What happened?
let's say that I have "A.json", "B.json", and "C.json".
If A and B or B and C are in the RAGDOC folder, I can get information from the files.
But, if all A, B, and C are in the RAGDOC folder, I cannot get any information.
Importance
I cannot use Kernel Memory
Platform, Language, Versions
.NET 8
Microsoft.Extensions.Configuration" Version="10.0.0-preview.1.25080.5"
Microsoft.KernelMemory" Version="0.97.250211.1"