gpt4all/gpt4all-bindings/csharp/Gpt4All/Prediction/TextPredictionResult.cs
mvenditto 8119ff4df0
C# bindings (#650)
* First workin version of the C# bindings

* Update README.md

Signed-off-by: mvenditto <venditto.matteo@gmail.com>

* Added more docs + fixed prompt callback signature

* build scripts revision

* Added .editorconfig + fixed style issues

---------

Signed-off-by: mvenditto <venditto.matteo@gmail.com>
2023-05-22 12:56:49 -07:00

27 lines
587 B
C#

using System.Text;
namespace Gpt4All;
public record TextPredictionResult : ITextPredictionResult
{
private readonly StringBuilder _result;
public bool Success { get; internal set; } = true;
public string? ErrorMessage { get; internal set; }
internal TextPredictionResult()
{
_result = new StringBuilder();
}
internal void Append(string token)
{
_result.Append(token);
}
public Task<string> GetPredictionAsync(CancellationToken cancellationToken = default)
{
return Task.FromResult(_result.ToString());
}
}