Table of Contents

Interface IFileService

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

Defines the service interface for the FoundationaLLM File service.

public interface IFileService
Extension Methods

Methods

CreateFileForAgent(string, string, string, string, string, Stream, UnifiedUserIdentity, Dictionary<string, string>?)

Create a new file.

Task<Result<ContextFileRecord>> CreateFileForAgent(string instanceId, string origin, string agentName, string fileName, string contentType, Stream content, UnifiedUserIdentity userIdentity, Dictionary<string, string>? metadata = null)

Parameters

instanceId string

The FoundationaLLM instance identifier.

origin string

The origin of the file.

agentName string

The name of the agent.

fileName string

The original name of the file.

contentType string

The content type of the file.

content Stream

The Stream providing the raw content of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

metadata Dictionary<string, string>

Optional metadata dictionary associated with the file.

Returns

Task<Result<ContextFileRecord>>

A Task producing a Result<T> whose value is a ContextFileRecord describing the newly created file when successful; otherwise a failed result containing a domain error.

CreateFileForConversation(string, string, string?, string, string, string, Stream, UnifiedUserIdentity, Dictionary<string, string>?)

Create a new file.

Task<Result<ContextFileRecord>> CreateFileForConversation(string instanceId, string origin, string? agentName, string conversationId, string fileName, string contentType, Stream content, UnifiedUserIdentity userIdentity, Dictionary<string, string>? metadata = null)

Parameters

instanceId string

The FoundationaLLM instance identifier.

origin string

The origin of the file.

agentName string

The name of the agent.

conversationId string

The conversation identifier.

fileName string

The original name of the file.

contentType string

The content type of the file.

content Stream

The Stream providing the raw content of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

metadata Dictionary<string, string>

Optional metadata dictionary associated with the file.

Returns

Task<Result<ContextFileRecord>>

A Task producing a Result<T> whose value is a ContextFileRecord describing the newly created file when successful; otherwise a failed result containing a domain error.

DeleteFileRecord(string, string, UnifiedUserIdentity)

Deletes the file record associated with a file.

Task<Result> DeleteFileRecord(string instanceId, string fileId, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

fileId string

The identifier of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<Result>

A Task producing a Result indicating success when the record is deleted; otherwise a failed result containing a domain error.

GetFileContent(string, string, UnifiedUserIdentity)

Get the binary content of a file.

Task<Result<ContextFileContent>> GetFileContent(string instanceId, string fileId, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

fileId string

The identifier of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<Result<ContextFileContent>>

A Task producing a Result<T> whose value is a ContextFileContent containing the file's binary content when successful; otherwise a failed result containing a domain error.

GetFileContent(string, string, string, UnifiedUserIdentity)

Get the binary content of a file.

Task<Result<ContextFileContent>> GetFileContent(string instanceId, string conversationId, string fileName, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

conversationId string

The conversation identifier.

fileName string

The name of the file to retrieve.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<Result<ContextFileContent>>

A Task producing a Result<T> whose value is a ContextFileContent containing the file's binary content when successful; otherwise a failed result containing a domain error.

GetFileRecord(string, string, UnifiedUserIdentity)

Get the file record associated with a file.

Task<Result<ContextFileRecord>> GetFileRecord(string instanceId, string fileId, UnifiedUserIdentity userIdentity)

Parameters

instanceId string

The FoundationaLLM instance identifier.

fileId string

The identifier of the file.

userIdentity UnifiedUserIdentity

The UnifiedUserIdentity providing details about the user identity.

Returns

Task<Result<ContextFileRecord>>

A Task producing a Result<T> whose value is a ContextFileRecord representing the file record when successful; otherwise a failed result containing a domain error.