mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-24 19:53:38 +00:00
Some checks are pending
Build and Release / Verify (push) Waiting to run
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
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 / 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
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using AIStudio.Provider.OpenAI;
|
|
|
|
namespace AIStudio.Provider.Fireworks;
|
|
|
|
/// <summary>
|
|
/// Data model for a line in the response stream, for streaming completions.
|
|
/// </summary>
|
|
/// <param name="Id">The id of the response.</param>
|
|
/// <param name="Object">The object describing the response.</param>
|
|
/// <param name="Created">The timestamp of the response.</param>
|
|
/// <param name="Model">The model used for the response.</param>
|
|
/// <param name="Choices">The choices made by the AI.</param>
|
|
public readonly record struct ResponseStreamLine(string Id, string Object, uint Created, string Model, IList<Choice> Choices) : IResponseStreamLine
|
|
{
|
|
/// <inheritdoc />
|
|
public bool ContainsContent() => this != default && this.Choices.Count > 0;
|
|
|
|
/// <inheritdoc />
|
|
public ContentStreamChunk GetContent() => new(this.Choices[0].Delta.Content, []);
|
|
|
|
/// <summary>
|
|
/// What Fireworks says the request cost, on the one line which carries it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The same block the OpenAI chat completion API sends, because this is that wire format.
|
|
/// Not a positional parameter: the struct is built from JSON, and a further parameter would
|
|
/// only be a value nobody passes.
|
|
/// </remarks>
|
|
public ChatCompletionUsage? Usage { get; init; }
|
|
|
|
/// <inheritdoc />
|
|
public TokenUsage GetUsage() => this.Usage?.ToTokenUsage() ?? TokenUsage.UNKNOWN;
|
|
|
|
#region Implementation of IAnnotationStreamLine
|
|
|
|
//
|
|
// Currently, Fireworks does not provide source citations in their response stream.
|
|
//
|
|
|
|
/// <inheritdoc />
|
|
public bool ContainsSources() => false;
|
|
|
|
/// <inheritdoc />
|
|
public IList<ISource> GetSources() => [];
|
|
|
|
#endregion
|
|
} |