FoundationaLLM.Client.Core is a .NET library that simplifies integrating the FoundationaLLM Core API into your projects and data workflows.
License
—
Deps
1
Install Size
—
Vulns
✓ 0
Published
Feb 26, 2026
$ dotnet add package FoundationaLLM.Client.CoreThe FoundationaLLM Core Client is a .NET client library that simplifies the process of interacting with the FoundationaLLM Core API. The client library provides a set of classes and methods that allow you to interact with the FoundationaLLM Core API in a more intuitive way.
This library contains two primary classes:
CoreRESTClient: A class that provides a set of methods for interacting with the FoundationaLLM Core API using REST. This is considered the low-level client and provides direct access to all Core API endpoints.CoreClient: A class that provides a set of methods for interacting with the FoundationaLLM Core API using a higher-level abstraction. This class is designed to simplify the process of interacting with the Core API by providing a more intuitive interface. It does not contain all the methods available in the CoreRESTClient class, but it provides a more user-friendly way to interact with the Core API.[!NOTE] These two classes are mutually exclusive, and you should choose one based on your requirements. If you need direct access to all Core API endpoints, use the
CoreRESTClientclass. If you need a more user-friendly interface, use theCoreClientclass.
[!TIP] If you do not have FoundationaLLM deployed, follow the Quick Start Deployment instructions to get FoundationaLLM deployed in your Azure subscription.
Install the NuGet package:
dotnet add package FoundationaLLM.Client.Core
Complete the following steps if you do not want to use dependency injection:
Create a new instance of the CoreRESTClient and CoreClient classes:
var coreUri = "<YOUR_CORE_API_URL>"; // e.g., "https://myfoundationallmcoreapi.com"
var instanceId = "<YOUR_INSTANCE_ID>"; // Each FoundationaLLM deployment has a unique (GUID) ID. Locate this value in the FoundationaLLM Management Portal or in Azure App Config (FoundationaLLM:Instance:Id key)
var credential = new AzureCliCredential(); // Can use any TokenCredential implementation, such as ManagedIdentityCredential or AzureCliCredential.
var options = new APIClientSettings // Optional settings parameter. Default timeout is 900 seconds.
{
Timeout = TimeSpan.FromSeconds(600)
};
var coreRestClient = new CoreRESTClient(
coreUri,
credential,
instanceId,
options);
var coreClient = new CoreClient(
coreUri,
credential,
instanceId,
options);
Make a request to the Core API with the CoreRESTClient class:
var status = await coreRestClient.Status.GetServiceStatusAsync();
Make a request to the Core API with the CoreClient class:
var results = await coreClient.GetAgentsAsync();
[!TIP] You can use the
FoundationaLLM.Common.Authentication.DefaultAuthenticationclass to generate theTokenCredential. This class sets theAzureCredentialproperty using theManagedIdentityCredentialwhen running in a production environment (productionparameter of theInitializemethod) and theAzureCliCredentialwhen running in a development environment.Example:
DefaultAuthentication.Initialize(false, "Test");var credentials = DefaultAuthentication.AzureCredential;
Rather than manually instantiating the CoreRESTClient and CoreClient classes, you can use dependency injection to manage the instances. This approach is more flexible and allows you to easily switch between different implementations of the ICoreClient and ICoreRESTClient interfaces.
Create a configuration file (e.g., appsettings.json) with the following content:
{
"FoundationaLLM": {
"APIEndpoints": {
"CoreAPI": {
"Essentials": {
"APIUrl": "https://localhost:63279/"
}
},
},
"Instance": {
"Id": "00000000-0000-0000-0000-000000000000"
}
}
}
Read the configuration file:
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.Build();
Use the CoreClient extension method to add the CoreClient and CoreRESTClient to the service collection:
var services = new ServiceCollection();
var credential = new AzureCliCredential(); // Can use any TokenCredential implementation, such as ManagedIdentityCredential or AzureCliCredential.
services.AddCoreClient(
configuration[AppConfigurationKeys.FoundationaLLM_APIEndpoints_CoreAPI_Essentials_APIUrl]!,
credential,
configuration[AppConfigurationKeys.FoundationaLLM_Instance_Id]!);
var serviceProvider = services.BuildServiceProvider();
Retrieve the CoreClient and CoreRESTClient instances from the service provider:
var coreClient = serviceProvider.GetRequiredService<ICoreClient>();
var coreRestClient = serviceProvider.GetRequiredService<ICoreRESTClient>();
Alternately, you can inject the CoreClient and CoreRESTClient instances directly into your classes using dependency injection.
public class MyService
{
private readonly ICoreClient _coreClient;
private readonly ICoreRESTClient _coreRestClient;
public MyService(ICoreClient coreClient, ICoreRESTClient coreRestClient)
{
_coreClient = coreClient;
_coreRestClient = coreRestClient;
}
}
If you prefer to retrieve the configuration settings from Azure App Configuration, you can use the Microsoft.Azure.AppConfiguration.AspNetCore or Microsoft.Extensions.Configuration.AzureAppConfiguration package to retrieve the configuration settings from Azure App Configuration.
Connect to Azure App Configuration:
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.AddAzureAppConfiguration(options =>
{
options.Connect("<connection-string>");
options.ConfigureKeyVault(kv =>
{
kv.SetCredential(Credentials);
});
options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance);
options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Essentials);
})
.Build();
If you have configured your local development environment, you can obtain the App Config connection string from an environment variable (
Environment.GetEnvironmentVariable(EnvironmentVariables.FoundationaLLM_AppConfig_ConnectionString)) when developing locally.
Use the CoreClient extension method to add the CoreClient and CoreRESTClient to the service collection:
var services = new ServiceCollection();
var credential = new AzureCliCredential(); // Can use any TokenCredential implementation, such as ManagedIdentityCredential or AzureCliCredential.
services.AddCoreClient(
configuration[AppConfigurationKeys.FoundationaLLM_APIEndpoints_CoreAPI_Essentials_APIUrl]!,
credential,
configuration[AppConfigurationKeys.FoundationaLLM_Instance_Id]!);
Retrieve the CoreClient and CoreRESTClient instances from the service provider:
var coreClient = serviceProvider.GetRequiredService<ICoreClient>();
var coreRestClient = serviceProvider.GetRequiredService<ICoreRESTClient>();
The Core.Examples test project contains several examples that demonstrate how to use the CoreClient and CoreRESTClient classes to interact with the Core API through a series of end-to-end tests.
FoundationaLLM provides the platform for deploying, scaling, securing and governing generative AI in the enterprise. With FoundationaLLM you can:
[!NOTE] FoundationaLLM is not a large language model. It enables you to use the large language models of your choice (e.g., OpenAI GPT-4, Mistral, LLama 2, etc.)
FoundationaLLM deploys a secure, comprehensive and highly configurable copilot platform to your Azure cloud environment:
Simply put we saw a lot of folks reinventing the wheel just to get a customized copilot or AI agent that was grounded and bases its responses in their own data as opposed to the trained parametric knowledge of the model. Many of the solutions we saw made for great demos, but were effectively toys wrapping calls to OpenAI endpoints- they were not something intended or ready to take into production at enterprise scale. We built FoundationaLLM to provide a continuous journey, one that was quick to get started with so folks could experiment quickly with LLM's but not fall off a cliff after that with a solution that would be insecure, unlicensed, inflexible and not fully featured enough to grow from the prototype into a production solution without having to start all over.
The core problems to deliver enterprise copilots or AI agents are:
Get up to speed with FoundationaLLM by reading the documentation. This includes deployment instructions, quickstarts, architecture, and API references.
FoundationaLLM provides a simple command line driven approach to getting your first deployment up and running. Basically, it's two commands. After that, you can customize the solution, run it locally on your machine and update the deployment with your customizations.
Follow the Quick Start Deployment instructions to get FoundationaLLM deployed in your Azure subscription.
If you encounter any issues with FoundationaLLM, please open an issue on GitHub. We will respond to your issue as soon as possible. Please use the Labels (bug, documentation, general question, release x.x.x) to categorize your issue and provide as much detail as possible to help us understand and resolve the issue.