mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 21:33:47 +00:00
Rebuilt how AI Studio knows what a model can do (#960)
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
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
This commit is contained in:
1 parent
d21e09dd1e
commit
d85b4e71b6
287 files changed
+18341
-3677
No files matched your search
@@ -0,0 +1,68 @@
|
||||
using AIStudio.Models.Matching;
|
||||
using AIStudio.Provider;
|
||||
|
||||
namespace AIStudio.Models.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// The ordinary host: it serves models under the names they are known by, through the ordinary API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Most hosts differ from each other in one sentence, and this is what carries the rest. A host
|
||||
/// which wraps its names says how to unwrap one; a host which speaks an API the others do not says
|
||||
/// so; everything else is stated here once.
|
||||
///
|
||||
/// What a source means for a host: the page names where the behaviour is documented, so that a
|
||||
/// person can re-check it in a minute. The statements themselves were read off the app's own
|
||||
/// provider implementations and the model corpus, both of which are in this repository -- the
|
||||
/// pages are where somebody looks when they doubt them.
|
||||
/// </remarks>
|
||||
public abstract class ModelHost : IModelHost
|
||||
{
|
||||
/// <summary>
|
||||
/// The two capabilities which say through which API a model is reached.
|
||||
/// </summary>
|
||||
private const Capability THE_APIS = Capability.CHAT_COMPLETION_API | Capability.RESPONSES_API;
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract LLMProviders Provider { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract ModelSource Source { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// Nothing is wrapped here: this host serves models under the names they are known by.
|
||||
/// </remarks>
|
||||
public virtual bool TryUnwrap(in ModelId id, out ModelId inner, out ModelVendor? declaredVendor)
|
||||
{
|
||||
inner = id;
|
||||
declaredVendor = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// The Responses API is OpenAI's own, and the app speaks it in exactly one place, its OpenAI
|
||||
/// provider. Wherever else a model is reached, it is reached through the ordinary chat
|
||||
/// completion API -- whatever the model itself could do at its vendor.
|
||||
/// </remarks>
|
||||
public virtual ModelProfile ApplyTransport(in ModelProfile profile) => ThroughTheOrdinaryApi(profile);
|
||||
|
||||
/// <summary>
|
||||
/// Puts a profile on the ordinary chat completion API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A profile which says nothing about APIs is left alone. An embedding model is reached through
|
||||
/// neither of the two, and answering that it speaks the chat completion API would be a claim
|
||||
/// nobody made.
|
||||
/// </remarks>
|
||||
/// <param name="profile">What the model can do.</param>
|
||||
/// <returns>What it can do when reached through the ordinary API.</returns>
|
||||
public static ModelProfile ThroughTheOrdinaryApi(in ModelProfile profile)
|
||||
{
|
||||
if (!profile.HasAny(THE_APIS))
|
||||
return profile;
|
||||
|
||||
return profile with { Capabilities = (profile.Capabilities & ~Capability.RESPONSES_API) | Capability.CHAT_COMPLETION_API };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user