Interface ICoreService
- Namespace
- FoundationaLLM.Core.Interfaces
- Assembly
- FoundationaLLM.Core.dll
Contains methods for managing chat sessions and messages, and for getting completions from the orchestrator.
public interface ICoreService
- Extension Methods
Methods
CreateConversationAsync(string, ChatSessionProperties)
Creates a new chat session.
Task<Conversation> CreateConversationAsync(string instanceId, ChatSessionProperties chatSessionProperties)
Parameters
instanceId
stringThe instance Id.
chatSessionProperties
ChatSessionPropertiesThe session properties.
Returns
DeleteAttachments(string, List<string>, UnifiedUserIdentity)
Deletes one or more attachments.
Task<Dictionary<string, ResourceProviderDeleteResult?>> DeleteAttachments(string instanceId, List<string> resourcePaths, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance id.
resourcePaths
List<string>The list of resources to be deleted.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
Returns
- Task<Dictionary<string, ResourceProviderDeleteResult>>
A dictionary with the delete operation result for each resource path.
DeleteConversationAsync(string, string)
Delete a chat session and related messages.
Task DeleteConversationAsync(string instanceId, string sessionId)
Parameters
Returns
DownloadAttachment(string, string, string, UnifiedUserIdentity)
Downloads an attachment.
Task<AttachmentFile?> DownloadAttachment(string instanceId, string fileProvider, string fileId, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance id.
fileProvider
stringThe name of the file provider.
fileId
stringThe identifier of the file.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
Returns
- Task<AttachmentFile>
An AttachmentFile object with the properties and the content of the attachment.
Remarks
The following file providers are supported:
- FoundationaLLM.Attachments
- FoundationaLLM.AzureOpenAI
GetAllConversationsAsync(string)
Returns list of chat session ids and names.
Task<List<Conversation>> GetAllConversationsAsync(string instanceId)
Parameters
instanceId
stringThe instance id for which to retrieve chat sessions.
Returns
GetChatCompletionAsync(string, CompletionRequest)
Receive a prompt from a user, retrieve the message history from the related session, generate a completion response, and log full completion results.
Task<Message> GetChatCompletionAsync(string instanceId, CompletionRequest completionRequest)
Parameters
instanceId
stringThe instance id.
completionRequest
CompletionRequestThe completion request.
Returns
GetChatSessionMessagesAsync(string, string)
Returns the chat messages related to an existing session.
Task<List<Message>> GetChatSessionMessagesAsync(string instanceId, string sessionId)
Parameters
instanceId
stringThe instance id for which to retrieve chat messages.
sessionId
stringThe session id for which to retrieve chat messages.
Returns
GetCompletionAsync(string, CompletionRequest)
Provides a completion for a user prompt, without a session.
Task<Message> GetCompletionAsync(string instanceId, CompletionRequest directCompletionRequest)
Parameters
instanceId
stringThe instance id.
directCompletionRequest
CompletionRequestThe completion request.
Returns
GetCompletionOperationStatus(string, string)
Gets the status of a completion operation.
Task<LongRunningOperation> GetCompletionOperationStatus(string instanceId, string operationId)
Parameters
instanceId
stringThe FoundationaLLM instance id.
operationId
stringThe OperationId for which to retrieve the status.
Returns
- Task<LongRunningOperation>
Returns a LongRunningOperation object containing the OperationId, Status, and result.
GetCompletionPrompt(string, string, string)
Returns the completion prompt for a given session and completion prompt id.
Task<CompletionPrompt> GetCompletionPrompt(string instanceId, string sessionId, string completionPromptId)
Parameters
instanceId
stringThe instance Id.
sessionId
stringThe session id from which to retrieve the completion prompt.
completionPromptId
stringThe id of the completion prompt to retrieve.
Returns
GetCoreConfiguration(string, UnifiedUserIdentity)
Gets the file store configuration for the given instance.
Task<CoreConfiguration> GetCoreConfiguration(string instanceId, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance id.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
Returns
- Task<CoreConfiguration>
The file store configuration.
RateMessageAsync(string, string, string, MessageRatingRequest)
Rate an assistant message. This can be used to discover useful AI responses for training, discoverability, and other benefits down the road.
Task RateMessageAsync(string instanceId, string id, string sessionId, MessageRatingRequest rating)
Parameters
instanceId
stringThe instance id.
id
stringThe message id to rate.
sessionId
stringThe session id to which the message belongs.
rating
MessageRatingRequestThe rating and optional comments to assign to the message.
Returns
RenameConversationAsync(string, string, ChatSessionProperties)
Rename the chat session from its default (eg., "New Chat") to the summary provided by OpenAI.
Task<Conversation> RenameConversationAsync(string instanceId, string sessionId, ChatSessionProperties chatSessionProperties)
Parameters
instanceId
stringThe instance id.
sessionId
stringThe session id to rename.
chatSessionProperties
ChatSessionPropertiesThe session properties.
Returns
StartCompletionOperation(string, CompletionRequest)
Begins a completion operation.
Task<LongRunningOperation> StartCompletionOperation(string instanceId, CompletionRequest completionRequest)
Parameters
instanceId
stringThe FoundationaLLM instance id.
completionRequest
CompletionRequestThe completion request containing the user prompt and message history.
Returns
- Task<LongRunningOperation>
Returns an LongRunningOperation object containing the OperationId and Status.
UploadAttachment(string, string, AttachmentFile, string, UnifiedUserIdentity)
Uploads an attachment.
Task<ResourceProviderUpsertResult<AttachmentFile>> UploadAttachment(string instanceId, string sessionId, AttachmentFile attachmentFile, string agentName, UnifiedUserIdentity userIdentity)
Parameters
instanceId
stringThe FoundationaLLM instance id.
sessionId
stringThe session id from which the attachment is uploaded.
attachmentFile
AttachmentFileThe AttachmentFile object containing the attachment file data.
agentName
stringThe name of the agent.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing information about the calling user identity.
Returns
- Task<ResourceProviderUpsertResult<AttachmentFile>>
A ResourceProviderUpsertResult<T> object with the FoundationaLLM.Attachment resource provider object id.