Table of Contents

Interface IKnowledgeService

Namespace
FoundationaLLM.Context.Interfaces
Assembly
FoundationaLLM.ContextEngine.dll

Defines the service interface for the FoundationaLLM Knowledge Graph service.

public interface IKnowledgeService
Extension Methods

Methods

GetKnowledgeSource(string, string, string?, UnifiedUserIdentity)

Retrieves a specified knowledge source.

Task<Result<ResourceProviderGetResult<KnowledgeSource>>> GetKnowledgeSource(string instanceId, string knowledgeSourceId, string? agentName, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSourceId string

The knowledge source identifier.

agentName string

The agent name if the request is being made on behalf of an agent.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ResourceProviderGetResult<KnowledgeSource>>>

A Task producing a Result<T> whose value is a ResourceProviderGetResult<T> containing the KnowledgeSource and its assigned roles/actions when successful; otherwise a failed result with a domain error.

GetKnowledgeSources(string, ContextKnowledgeResourceListRequest, UnifiedUserIdentity)

Retrieves the list of knowledge sources.

Task<Result<IEnumerable<ResourceProviderGetResult<KnowledgeSource>>>> GetKnowledgeSources(string instanceId, ContextKnowledgeResourceListRequest listRequest, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

listRequest ContextKnowledgeResourceListRequest

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

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<IEnumerable<ResourceProviderGetResult<KnowledgeSource>>>>

A Task producing a Result<T> whose value is an enumerable of ResourceProviderGetResult<T> items for the matching KnowledgeSource resources; otherwise a failed result with a domain error.

GetKnowledgeUnit(string, string, string?, UnifiedUserIdentity)

Retrieves a specified knowledge unit.

Task<Result<ResourceProviderGetResult<KnowledgeUnit>>> GetKnowledgeUnit(string instanceId, string knowledgeUnitId, string? agentName, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string

The knowledge unit identifier.

agentName string

The agent name if the request is being made on behalf of an agent.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ResourceProviderGetResult<KnowledgeUnit>>>

A Task producing a Result<T> whose value is a ResourceProviderGetResult<T> containing the KnowledgeUnit and its assigned roles/actions when successful; otherwise a failed result with a domain error.

GetKnowledgeUnits(string, ContextKnowledgeResourceListRequest, UnifiedUserIdentity)

Retrieves the list of knowledge units.

Task<Result<IEnumerable<ResourceProviderGetResult<KnowledgeUnit>>>> GetKnowledgeUnits(string instanceId, ContextKnowledgeResourceListRequest listRequest, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

listRequest ContextKnowledgeResourceListRequest

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

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<IEnumerable<ResourceProviderGetResult<KnowledgeUnit>>>>

A Task producing a Result<T> whose value is an enumerable of ResourceProviderGetResult<T> items for the matching KnowledgeUnit resources; otherwise a failed result with a domain error.

QueryKnowledgeSource(string, string, ContextKnowledgeSourceQueryRequest, UnifiedUserIdentity)

Queries a knowledge source.

Task<Result<ContextKnowledgeSourceQueryResponse>> QueryKnowledgeSource(string instanceId, string knowledgeSourceId, ContextKnowledgeSourceQueryRequest queryRequest, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSourceId string

The knowledge source identifier.

queryRequest ContextKnowledgeSourceQueryRequest

The request containing the details of the query.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ContextKnowledgeSourceQueryResponse>>

A Task producing a Result<T> whose value is a ContextKnowledgeSourceQueryResponse containing vector store and/or knowledge graph results when successful; otherwise a failed result with a domain error.

RenderKnowledgeUnitGraph(string, string, ContextKnowledgeSourceQueryRequest?, UnifiedUserIdentity)

Retrieves the knowledge unit's knowledge graph in a format suitable for visualization or further processing.

Task<Result<ContextKnowledgeUnitRenderGraphResponse>> RenderKnowledgeUnitGraph(string instanceId, string knowledgeUnitId, ContextKnowledgeSourceQueryRequest? queryRequest, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string

The knowledge unit identifier.

queryRequest ContextKnowledgeSourceQueryRequest

The request containing the details of the query.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ContextKnowledgeUnitRenderGraphResponse>>

A Task producing a Result<T> whose value is a ContextKnowledgeUnitRenderGraphResponse containing nodes and edges when successful; otherwise a failed result with a domain error.

SetKnowledgeUnitGraph(string, string, ContextKnowledgeUnitSetGraphRequest, UnifiedUserIdentity)

Sets the knowledge graph associated with a knowledge unit.

Task<Result<ResourceProviderActionResult>> SetKnowledgeUnitGraph(string instanceId, string knowledgeUnitId, ContextKnowledgeUnitSetGraphRequest setGraphRequest, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnitId string

The knowledge unit identifier.

setGraphRequest ContextKnowledgeUnitSetGraphRequest

The request containing the knowledge graph details.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ResourceProviderActionResult>>

A Task producing a Result<T> whose value is a ResourceProviderActionResult indicating the graph set operation outcome; otherwise a failed result with a domain error.

UpsertKnowledgeSource(string, KnowledgeSource, UnifiedUserIdentity)

Creates or updates a knowledge source in the context service.

Task<Result<ResourceProviderUpsertResult<KnowledgeSource>>> UpsertKnowledgeSource(string instanceId, KnowledgeSource knowledgeSource, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeSource KnowledgeSource

The knowledge source to be created or updated.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ResourceProviderUpsertResult<KnowledgeSource>>>

A Task producing a Result<T> whose value is a ResourceProviderUpsertResult<T> describing the upsert outcome for the KnowledgeSource; otherwise a failed result with a domain error.

UpsertKnowledgeUnit(string, KnowledgeUnit, UnifiedUserIdentity)

Creates or updates a knowledge unit in the context service.

Task<Result<ResourceProviderUpsertResult<KnowledgeUnit>>> UpsertKnowledgeUnit(string instanceId, KnowledgeUnit knowledgeUnit, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

knowledgeUnit KnowledgeUnit

The knowledge unit to be created or updated.

userIdentity UnifiedUserIdentity

The identity of the security principal submitting the request.

Returns

Task<Result<ResourceProviderUpsertResult<KnowledgeUnit>>>

A Task producing a Result<T> whose value is a ResourceProviderUpsertResult<T> describing the upsert outcome for the KnowledgeUnit; otherwise a failed result with a domain error.