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
coreService
ICoreServiceThe Core service provides methods for managing chat sessions and messages, and for getting completions from the orchestrator.
logger
ILogger<SessionsController>The logging interface used to log under the SessionsController type name.
Remarks
Constructor for the Sessions Controller.
Methods
CreateNewChatSession(string, ChatSessionProperties)
Creates a new chat session.
[HttpPost(Name = "CreateNewChatSession")]
public Task<Conversation> CreateNewChatSession(string instanceId, ChatSessionProperties chatSessionProperties)
Parameters
instanceId
stringThe id of the instance.
chatSessionProperties
ChatSessionPropertiesThe session properties.
Returns
DeleteChatSession(string, string)
Delete a chat session and related messages.
[HttpDelete("{sessionId}", Name = "DeleteChatSession")]
public Task DeleteChatSession(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
instanceId
stringThe 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
instanceId
stringThe id of the instance.
sessionId
stringThe 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
instanceId
stringThe id of the instance.
sessionId
stringThe session id from which to retrieve the completion prompt.
completionPromptId
stringThe 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
instanceId
stringThe id of the instance.
messageId
stringThe id of the message to rate.
sessionId
stringThe id of the session to which the message belongs.
ratingRequest
MessageRatingRequestThe rating and optional comments to assign to the message.
Returns
RenameChatSession(string, string, ChatSessionProperties)
Rename the chat session.
[HttpPost("{sessionId}/rename", Name = "RenameChatSession")]
public Task<Conversation> RenameChatSession(string instanceId, string sessionId, ChatSessionProperties chatSessionProperties)
Parameters
instanceId
stringThe id of the instance.
sessionId
stringThe id of the session to rename.
chatSessionProperties
ChatSessionPropertiesThe session properties.