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
- coreServiceICoreService
- The 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
- instanceIdstring
- The id of the instance. 
- chatSessionPropertiesConversationProperties
- The 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
- instanceIdstring
- The 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
- instanceIdstring
- The id of the instance. 
- sessionIdstring
- The 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
- instanceIdstring
- The id of the instance. 
- sessionIdstring
- The session id from which to retrieve the completion prompt. 
- completionPromptIdstring
- The 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
- instanceIdstring
- The id of the instance. 
- messageIdstring
- The id of the message to rate. 
- sessionIdstring
- The id of the session to which the message belongs. 
- ratingRequestMessageRatingRequest
- The 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
- instanceIdstring
- The FoundationaLLM instance identifier. 
- conversationIdstring
- The identifier of the conversation to update. 
- conversationPropertiesConversationProperties
- The conversation properties to be updated.