Table of Contents

Interface ICoreClient

Namespace
FoundationaLLM.Client.Core.Interfaces
Assembly
FoundationaLLM.Client.Core.dll

Provides high-level methods to interact with the Core API.

public interface ICoreClient
Extension Methods

Methods

AttachFileAndAskQuestionAsync(Stream, string, string, string, string, bool, string?, ChatSessionProperties?)

Attaches a file to the completion request and sends a question to the agent using the Core API.If the useSession parameter is true, the method uses an existing session or creates a new chat session and optionally renames it. existing session

Task<Message> AttachFileAndAskQuestionAsync(Stream fileStream, string fileName, string contentType, string agentName, string question, bool useSession, string? sessionId, ChatSessionProperties? chatSessionProperties)

Parameters

fileStream Stream

The file contents of the new Attachment resource.

fileName string

The name of the file.

contentType string

The Content-Type header value of a valid mime type that is used to create a new MediaTypeHeaderValue as part of the MultipartFormDataContent sent to the API endpoint.

agentName string

The name of the FoundationaLLM agent that will handle the completion request.

question string

The user prompt to send to the agent along with the attachment.

useSession bool

If true, the completion is sent to a new or existing session. If false, no session is created and the sessionless orchestration flow is used.

sessionId string

The ID of an existing session. If null or empty, a new session is created first.

chatSessionProperties ChatSessionProperties

Optional session properties.

Returns

Task<Message>

A completion from the designated FoundationaLLM agent.

CreateChatSessionAsync(ChatSessionProperties)

Creates a new chat session with the specified name.

Task<string> CreateChatSessionAsync(ChatSessionProperties sessionProperties)

Parameters

sessionProperties ChatSessionProperties

The session properties.

Returns

Task<string>

The new chat session ID.

DeleteSessionAsync(string)

Deletes a chat session.

Task DeleteSessionAsync(string sessionId)

Parameters

sessionId string

The ID of the session to delete.

Returns

Task

GetAgentsAsync()

Retrieves agents available to the user for orchestration and session-based requests.

Task<IEnumerable<ResourceProviderGetResult<AgentBase>>> GetAgentsAsync()

Returns

Task<IEnumerable<ResourceProviderGetResult<AgentBase>>>

A list of available agents.

GetChatSessionMessagesAsync(string)

Returns the chat messages related to an existing session.

Task<IEnumerable<Message>> GetChatSessionMessagesAsync(string sessionId)

Parameters

sessionId string

Returns

Task<IEnumerable<Message>>

GetCompletionAsync(CompletionRequest)

Runs a single completion with an agent using the Core API without a chat session (sessionless). This method sends a user prompt to the agent and returns the completion response. You must ensure that the completion request contains an AgentName and UserPrompt.

Task<Message> GetCompletionAsync(CompletionRequest completionRequest)

Parameters

completionRequest CompletionRequest

The orchestration request that contains the AgentName and UserPrompt at a minimum.

Returns

Task<Message>

A completion from the designated FoundationaLLM agent.

GetCompletionAsync(string, string)

Runs a single completion with an agent using the Core API without a chat session (sessionless). This method sends a user prompt to the agent and returns the completion response.

Task<Message> GetCompletionAsync(string userPrompt, string agentName)

Parameters

userPrompt string

The user prompt to send to the agent.

agentName string

The name of the FoundationaLLM agent that will handle the completion request.

Returns

Task<Message>

A completion from the designated FoundationaLLM agent.

GetCompletionWithSessionAsync(CompletionRequest)

Runs a single completion request with an agent using the Core API and a chat session. You must ensure that the orchestration request contains a SessionID, AgentName, and UserPrompt.

Task<Message> GetCompletionWithSessionAsync(CompletionRequest completionRequest)

Parameters

completionRequest CompletionRequest

The orchestration request that contains the SessionID, AgentName, and UserPrompt at a minimum.

Returns

Task<Message>

A completion from the designated FoundationaLLM agent.

GetCompletionWithSessionAsync(string?, ChatSessionProperties?, string, string)

Runs a single completion request with an agent using the Core API and a chat session. To specify an existing session, provide the session ID. Otherwise, a new session will be created. If the session name is provided, the session is renamed.

Task<Message> GetCompletionWithSessionAsync(string? sessionId, ChatSessionProperties? sessionProperties, string userPrompt, string agentName)

Parameters

sessionId string

The ID of an existing session. If null or empty, a new session is created first.

sessionProperties ChatSessionProperties

Optional session priperties.

userPrompt string

The user prompt to send to the agent.

agentName string

The name of the FoundationaLLM agent that will handle the completion request.

Returns

Task<Message>

A completion from the designated FoundationaLLM agent.

RateMessageAsync(string, string, MessageRatingRequest)

Sets the rating for a message.

Task RateMessageAsync(string sessionId, string messageId, MessageRatingRequest rating)

Parameters

sessionId string

The chat session ID that contains the message to rate.

messageId string

The ID of the message to rate.

rating MessageRatingRequest

The rating and optional comments to assign to the message.

Returns

Task