mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-13 22:33:37 +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
57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
namespace AIStudio.Models;
|
|
|
|
/// <summary>
|
|
/// How much a model can read and write in one conversation, in tokens.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Two numbers, because the model cards name two. There is what the model does as it ships, and
|
|
/// there is what an operator can raise it to by configuring the engine, usually through one of the
|
|
/// rope-scaling settings. A self-hosted model runs at whatever its operator chose, so the second
|
|
/// number is a ceiling, not a promise.
|
|
///
|
|
/// Nothing here says "unknown" with a zero. The default value of this type is unknown, which is the
|
|
/// right answer for a model nobody has written anything about yet, and a known window can never be
|
|
/// zero tokens wide because the factory below refuses to build one.
|
|
/// </remarks>
|
|
public readonly record struct ContextWindow
|
|
{
|
|
/// <summary>
|
|
/// The window of a model we have no statement about.
|
|
/// </summary>
|
|
public static readonly ContextWindow UNKNOWN = new();
|
|
|
|
/// <summary>
|
|
/// Whether anything is known about this window at all. When false, both numbers are meaningless.
|
|
/// </summary>
|
|
public bool IsKnown { get; private init; }
|
|
|
|
/// <summary>
|
|
/// What the model reads and writes without anyone configuring it.
|
|
/// </summary>
|
|
public int DefaultTokens { get; private init; }
|
|
|
|
/// <summary>
|
|
/// What an operator can raise the window to, or null when it cannot be raised or nobody knows.
|
|
/// </summary>
|
|
public int? RaisableToTokens { get; private init; }
|
|
|
|
/// <summary>
|
|
/// States a known context window.
|
|
/// </summary>
|
|
/// <param name="defaultTokens">What the model does as it ships. Has to be greater than zero.</param>
|
|
/// <param name="raisableTo">What an operator can raise it to. Has to be at least the default.</param>
|
|
/// <returns>The window.</returns>
|
|
public static ContextWindow Of(int defaultTokens, int? raisableTo = null)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(defaultTokens);
|
|
if (raisableTo is not null)
|
|
ArgumentOutOfRangeException.ThrowIfLessThan(raisableTo.Value, defaultTokens);
|
|
|
|
return new()
|
|
{
|
|
IsKnown = true,
|
|
DefaultTokens = defaultTokens,
|
|
RaisableToTokens = raisableTo,
|
|
};
|
|
}
|
|
} |