Class SessionsController
- Namespace
- FoundationaLLM.Core.API.Controllers
- Assembly
- FoundationaLLM.Core.API.dll
Provides methods for retrieving and managing sessions.
[Authorize(AuthenticationSchemes = "Bearer", Policy = "MicrosoftEntraIDStandard")]
[Authorize(AuthenticationSchemes = "AgentAccessToken", Policy = "FoundationaLLMAgentAccessToken")]
[ApiController]
[Route("instances/{instanceId}/[controller]")]
public class SessionsController : ControllerBase
- Inheritance
-
SessionsController
- Inherited Members
- Extension Methods
Remarks
Constructor for the Sessions Controller.
Constructors
SessionsController(ICoreService, ILogger<SessionsController>)
Provides methods for retrieving and managing sessions.
public SessionsController(ICoreService coreService, ILogger<SessionsController> logger)
Parameters
coreServiceICoreServiceThe Core service provides methods for managing chat sessions and messages, and for getting completions from the orchestrator.
loggerILogger<SessionsController>The logging interface used to log under the SessionsController type name.
Remarks
Constructor for the Sessions Controller.
Methods
CreateConversation(string, ConversationProperties)
Creates a new chat session.
[HttpPost(Name = "CreateConversation")]
public Task<Conversation> CreateConversation(string instanceId, ConversationProperties chatSessionProperties)
Parameters
instanceIdstringThe id of the instance.
chatSessionPropertiesConversationPropertiesThe session properties.
Returns
DeleteConversation(string, string)
Delete a chat session and related messages.
[HttpDelete("{sessionId}", Name = "DeleteConversation")]
public Task DeleteConversation(string instanceId, string sessionId)
Parameters
Returns
GetAllChatSessions(string)
Returns list of chat session ids and names.
[HttpGet(Name = "GetAllChatSessions")]
public Task<IEnumerable<Conversation>> GetAllChatSessions(string instanceId)
Parameters
instanceIdstringThe id of the instance.
Returns
GetChatSessionMessages(string, string)
Returns the chat messages related to an existing session.
[HttpGet("{sessionId}/messages", Name = "GetChatSessionMessages")]
public Task<IEnumerable<Message>> GetChatSessionMessages(string instanceId, string sessionId)
Parameters
instanceIdstringThe id of the instance.
sessionIdstringThe id of the session for which to retrieve chat messages.
Returns
GetCompletionPrompt(string, string, string)
Returns the completion prompt for a given session and completion prompt id.
[HttpGet("{sessionId}/completionprompts/{completionPromptId}", Name = "GetCompletionPrompt")]
public Task<CompletionPrompt> GetCompletionPrompt(string instanceId, string sessionId, string completionPromptId)
Parameters
instanceIdstringThe id of the instance.
sessionIdstringThe session id from which to retrieve the completion prompt.
completionPromptIdstringThe id of the completion prompt to retrieve.
Returns
RateMessage(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.
[HttpPost("{sessionId}/message/{messageId}/rate", Name = "RateMessage")]
public Task RateMessage(string instanceId, string messageId, string sessionId, MessageRatingRequest ratingRequest)
Parameters
instanceIdstringThe id of the instance.
messageIdstringThe id of the message to rate.
sessionIdstringThe id of the session to which the message belongs.
ratingRequestMessageRatingRequestThe rating and optional comments to assign to the message.
Returns
UpdateConversation(string, string, ConversationProperties)
Update the conversation.
[HttpPost("{conversationId}/update", Name = "UpdateConversation")]
public Task<Conversation> UpdateConversation(string instanceId, string conversationId, ConversationProperties conversationProperties)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
conversationIdstringThe identifier of the conversation to update.
conversationPropertiesConversationPropertiesThe conversation properties to be updated.