mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-14 17:03:38 +00:00
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
34 lines
1.7 KiB
C#
34 lines
1.7 KiB
C#
namespace AIStudio.Provider.HuggingFace;
|
|
|
|
/// <summary>
|
|
/// One model as the Hugging Face router describes it.
|
|
/// </summary>
|
|
/// <param name="Id">The ID of the model, written as "org/model".</param>
|
|
/// <param name="Providers">The inference providers serving this model.</param>
|
|
public readonly record struct HFModel(string Id, IList<HFModelProvider>? Providers)
|
|
{
|
|
/// <summary>
|
|
/// The window this model has when it is reached the way this user set things up.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// A window belongs to an inference provider here, not to the model: the same weights run
|
|
/// behind several of them, each configured by somebody else. Where the user named one, its
|
|
/// number is the answer. Where they let the router choose, the smallest window among the
|
|
/// providers currently serving the model is -- nobody knows which one the router will take, and
|
|
/// a number promising more than the chosen provider delivers would walk a conversation into an
|
|
/// error the user could not see coming.
|
|
/// </remarks>
|
|
/// <param name="providerSlug">The inference provider the user chose, or empty when the router chooses.</param>
|
|
/// <returns>The window in tokens, or null where nobody stated one.</returns>
|
|
public int? ContextWindowTokens(string providerSlug)
|
|
{
|
|
if (this.Providers is null)
|
|
return null;
|
|
|
|
var serving = this.Providers.Where(provider => provider.IsLive);
|
|
if (!string.IsNullOrEmpty(providerSlug))
|
|
serving = serving.Where(provider => string.Equals(provider.Provider, providerSlug, StringComparison.OrdinalIgnoreCase));
|
|
|
|
return serving.Where(provider => provider.ContextWindowTokens is > 0).Min(provider => provider.ContextWindowTokens);
|
|
}
|
|
} |