Added optional returnEmbeddings parameter to /Entity/List
This commit is contained in:
@@ -55,7 +55,7 @@ public class EntityController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpGet("List")]
|
||||
public ActionResult<EntityListResults> List(string searchdomain)
|
||||
public ActionResult<EntityListResults> List(string searchdomain, bool returnEmbeddings = false)
|
||||
{
|
||||
EntityListResults entityListResults = new() {Results = []};
|
||||
Searchdomain searchdomain_ = _domainManager.GetSearchdomain(searchdomain);
|
||||
@@ -68,6 +68,8 @@ public class EntityController : ControllerBase
|
||||
}
|
||||
List<DatapointResult> datapointResults = [];
|
||||
foreach (Datapoint datapoint in entity.datapoints)
|
||||
{
|
||||
if (returnEmbeddings)
|
||||
{
|
||||
List<EmbeddingResult> embeddingResults = [];
|
||||
foreach ((string, float[]) embedding in datapoint.embeddings)
|
||||
@@ -76,6 +78,11 @@ public class EntityController : ControllerBase
|
||||
}
|
||||
datapointResults.Add(new DatapointResult() {Name = datapoint.name, ProbMethod = datapoint.probMethod.Method.Name, Embeddings = embeddingResults});
|
||||
}
|
||||
else
|
||||
{
|
||||
datapointResults.Add(new DatapointResult() {Name = datapoint.name, ProbMethod = datapoint.probMethod.Method.Name, Embeddings = null});
|
||||
}
|
||||
}
|
||||
EntityListResult entityListResult = new()
|
||||
{
|
||||
Name = entity.name,
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DatapointResult
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string ProbMethod { get; set; }
|
||||
public required List<EmbeddingResult> Embeddings { get; set; }
|
||||
public required List<EmbeddingResult>? Embeddings { get; set; }
|
||||
}
|
||||
|
||||
public class EmbeddingResult
|
||||
|
||||
Reference in New Issue
Block a user