Table of Contents

Class KnowledgeController

Namespace
FoundationaLLM.Context.API.Controllers
Assembly
FoundationaLLM.Context.API.dll

Provdes methods for managing files.

[ApiController]
[APIKeyAuthentication]
[Route("instances/{instanceId}")]
public class KnowledgeController : ControllerBase
Inheritance
KnowledgeController
Inherited Members
Extension Methods

Constructors

KnowledgeController(IKnowledgeService, IOrchestrationContext, ILogger<KnowledgeController>)

Provdes methods for managing files.

public KnowledgeController(IKnowledgeService knowledgeService, IOrchestrationContext callContext, ILogger<KnowledgeController> logger)

Parameters

knowledgeService IKnowledgeService

The IKnowledgeService knowledge service.

callContext IOrchestrationContext

The IOrchestrationContext call context associated with the current request.

logger ILogger<KnowledgeController>

The ILogger used for logging.

Methods

GetKnowledgeSource(string, string)

Retrieves a specified knowledge source.

[HttpGet("knowledgeSources/{knowledgeSourceId}")]
public Task<IActionResult> GetKnowledgeSource(string instanceId, string knowledgeSourceId)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSourceId string

The knowledge source identifier.

Returns

Task<IActionResult>

GetKnowledgeSources(string, ContextKnowledgeResourceListRequest)

Retrieves the list of knowledge sources.

[HttpPost("knowledgeSources/list")]
public Task<IActionResult> GetKnowledgeSources(string instanceId, ContextKnowledgeResourceListRequest listRequest)

Parameters

instanceId string

The FoundationaLLM instance identifier.

listRequest ContextKnowledgeResourceListRequest

The request containing the information used to filter the knowledge resources.

Returns

Task<IActionResult>

GetKnowledgeUnit(string, string)

Retrieves a specified knowledge unit.

[HttpGet("knowledgeUnits/{knowledgeUnitId}")]
public Task<IActionResult> GetKnowledgeUnit(string instanceId, string knowledgeUnitId)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string

The knowledge unit identifier.

Returns

Task<IActionResult>

GetKnowledgeUnits(string, ContextKnowledgeResourceListRequest)

Retrieves the list of knowledge units.

[HttpPost("knowledgeUnits/list")]
public Task<IActionResult> GetKnowledgeUnits(string instanceId, ContextKnowledgeResourceListRequest listRequest)

Parameters

instanceId string

The FoundationaLLM instance identifier.

listRequest ContextKnowledgeResourceListRequest

The request containing the information used to filter the knowledge resources.

Returns

Task<IActionResult>

QueryKnowledgeSource(string, string, ContextKnowledgeSourceQueryRequest)

Queries a knowledge graph.

[HttpPost("knowledgeSources/{knowledgeSourceId}/query")]
public Task<IActionResult> QueryKnowledgeSource(string instanceId, string knowledgeSourceId, ContextKnowledgeSourceQueryRequest queryRequest)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSourceId string
queryRequest ContextKnowledgeSourceQueryRequest

Returns

Task<IActionResult>

RenderKnowledgeUnitGraph(string, string, ContextKnowledgeSourceQueryRequest?)

Retrieves the knowledge graph in a format suitable for rendering.

[HttpPost("knowledgeUnits/{knowledgeUnitId}/render-graph")]
public Task<IActionResult> RenderKnowledgeUnitGraph(string instanceId, string knowledgeUnitId, ContextKnowledgeSourceQueryRequest? queryRequest)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string
queryRequest ContextKnowledgeSourceQueryRequest

Returns

Task<IActionResult>

SetKnowledgeUnitGraph(string, string, ContextKnowledgeUnitSetGraphRequest)

Sets the knowledge graph for a knowledge unit.

[HttpPost("knowledgeUnits/{knowledgeUnitId}/set-graph")]
public Task<IActionResult> SetKnowledgeUnitGraph(string instanceId, string knowledgeUnitId, ContextKnowledgeUnitSetGraphRequest setGraphRequest)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string

The knowledge unit identifier.

setGraphRequest ContextKnowledgeUnitSetGraphRequest

The request containing the information used to set the knowledge graph.

Returns

Task<IActionResult>

UpsertKnowledgeSource(string, KnowledgeSource)

Creates or updates a knowledge source.

[HttpPost("knowledgeSources")]
public Task<IActionResult> UpsertKnowledgeSource(string instanceId, KnowledgeSource knowledgeSource)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSource KnowledgeSource

The knowledge source to be created or updated.

Returns

Task<IActionResult>

UpsertKnowledgeUnit(string, KnowledgeUnit)

Creates or updates a knowledge unit.

[HttpPost("knowledgeUnits")]
public Task<IActionResult> UpsertKnowledgeUnit(string instanceId, KnowledgeUnit knowledgeUnit)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnit KnowledgeUnit

The knowledge unit to be created or updated.

Returns

Task<IActionResult>