69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
#load "../../Client/Client.cs"
|
|
#load "../Models/Script.cs"
|
|
#load "../Models/Interfaces.cs"
|
|
#load "../Models/WorkerResults.cs"
|
|
#load "../../Shared/Models/SearchdomainResults.cs"
|
|
#load "../../Shared/Models/JSONModels.cs"
|
|
#load "../../Shared/Models/EntityResults.cs"
|
|
|
|
using Shared.Models;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
public class ExampleScript : Indexer.Models.IScript
|
|
{
|
|
public Indexer.Models.ScriptToolSet ToolSet;
|
|
public Client.Client client;
|
|
string defaultSearchdomain;
|
|
string exampleContent;
|
|
string probMethod;
|
|
string similarityMethod;
|
|
string exampleSearchdomain;
|
|
int exampleCounter;
|
|
List<string> models;
|
|
string probmethodDatapoint;
|
|
string probmethodEntity;
|
|
|
|
public ExampleScript()
|
|
{
|
|
//System.Console.WriteLine("DEBUG@example.cs - Constructor"); // logger not passed here yet
|
|
exampleContent = "./Scripts/example_content";
|
|
probMethod = "HVEWAvg";
|
|
similarityMethod = "Cosine";
|
|
exampleSearchdomain = "example_" + probMethod;
|
|
exampleCounter = 0;
|
|
models = ["ollama:bge-m3", "ollama:mxbai-embed-large"];
|
|
probmethodDatapoint = probMethod;
|
|
probmethodEntity = probMethod;
|
|
}
|
|
|
|
public int Init(Indexer.Models.ScriptToolSet toolSet)
|
|
{
|
|
ToolSet = toolSet;
|
|
ToolSet.Logger.LogInformation("DEBUG@example.csx - Init");
|
|
SearchdomainListResults searchdomains = ToolSet.Client.SearchdomainListAsync().Result;
|
|
defaultSearchdomain = searchdomains.Searchdomains.First();
|
|
var searchdomainList = string.Join("\n", searchdomains.Searchdomains);
|
|
ToolSet.Logger.LogInformation(searchdomainList);
|
|
return 0;
|
|
}
|
|
|
|
public int Update(Indexer.Models.ICallbackInfos callbackInfos)
|
|
{
|
|
ToolSet.Logger.LogInformation("DEBUG@example.csx - Update");
|
|
EntityQueryResults test = ToolSet.Client.EntityQueryAsync(defaultSearchdomain, "DNA").Result;
|
|
var firstResult = test.Results.ToArray()[0];
|
|
ToolSet.Logger.LogInformation(firstResult.Name);
|
|
ToolSet.Logger.LogInformation(firstResult.Value.ToString());
|
|
return 0;
|
|
}
|
|
|
|
public int Stop()
|
|
{
|
|
ToolSet.Logger.LogInformation("DEBUG@example.csx - Stop");
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return new ExampleScript(); |