-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a718979
commit dcb8a20
Showing
6 changed files
with
143 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "2efc8ab", "specHash": "e798cb1", "version": "1.3.1" } | ||
{ "engineHash": "2efc8ab", "specHash": "90cf4e4", "version": "1.3.1" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Box.Sdk.Gen/Schemas/AiLlmEndpointParamsAws/AiLlmEndpointParamsAws.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using Box.Sdk.Gen; | ||
using System.Text.Json.Serialization; | ||
using Box.Sdk.Gen.Internal; | ||
using System.Collections.Generic; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
public class AiLlmEndpointParamsAws : ISerializable { | ||
[JsonInclude] | ||
[JsonPropertyName("_istemperatureSet")] | ||
protected bool _isTemperatureSet { get; set; } | ||
|
||
[JsonInclude] | ||
[JsonPropertyName("_istop_pSet")] | ||
protected bool _isTopPSet { get; set; } | ||
|
||
protected double? _temperature { get; set; } | ||
|
||
protected double? _topP { get; set; } | ||
|
||
/// <summary> | ||
/// The type of the AI LLM endpoint params object for AWS. | ||
/// This parameter is **required**. | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
[JsonConverter(typeof(StringEnumConverter<AiLlmEndpointParamsAwsTypeField>))] | ||
public StringEnum<AiLlmEndpointParamsAwsTypeField> Type { get; } | ||
|
||
/// <summary> | ||
/// What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random, | ||
/// while lower values like 0.2 will make it more focused and deterministic. | ||
/// We generally recommend altering this or `top_p` but not both. | ||
/// </summary> | ||
[JsonPropertyName("temperature")] | ||
public double? Temperature { get => _temperature; init { _temperature = value; _isTemperatureSet = true; } } | ||
|
||
/// <summary> | ||
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results | ||
/// of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability | ||
/// mass are considered. We generally recommend altering this or temperature but not both. | ||
/// </summary> | ||
[JsonPropertyName("top_p")] | ||
public double? TopP { get => _topP; init { _topP = value; _isTopPSet = true; } } | ||
|
||
public AiLlmEndpointParamsAws(AiLlmEndpointParamsAwsTypeField type = AiLlmEndpointParamsAwsTypeField.AwsParams) { | ||
Type = type; | ||
} | ||
|
||
[JsonConstructorAttribute] | ||
internal AiLlmEndpointParamsAws(StringEnum<AiLlmEndpointParamsAwsTypeField> type) { | ||
Type = AiLlmEndpointParamsAwsTypeField.AwsParams; | ||
} | ||
internal string? RawJson { get; set; } = default; | ||
|
||
void ISerializable.SetJson(string json) { | ||
RawJson = json; | ||
} | ||
|
||
string? ISerializable.GetJson() { | ||
return RawJson; | ||
} | ||
|
||
/// <summary> | ||
/// Returns raw json response returned from the API. | ||
/// </summary> | ||
public Dictionary<string, object?>? GetRawData() { | ||
return SimpleJsonSerializer.GetAllFields(this); | ||
} | ||
|
||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Box.Sdk.Gen/Schemas/AiLlmEndpointParamsAws/AiLlmEndpointParamsAwsTypeField.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.ComponentModel; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
public enum AiLlmEndpointParamsAwsTypeField { | ||
[Description("aws_params")] | ||
AwsParams | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...amsOpenAi/AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Box.Sdk.Gen; | ||
using System; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using Box.Sdk.Gen.Schemas; | ||
|
||
namespace Box.Sdk.Gen.Schemas { | ||
[JsonConverter(typeof(AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAiConverter))] | ||
public class AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi : OneOf<AiLlmEndpointParamsAws, AiLlmEndpointParamsGoogle, AiLlmEndpointParamsOpenAi> { | ||
public AiLlmEndpointParamsAws? AiLlmEndpointParamsAws => _val0; | ||
|
||
public AiLlmEndpointParamsGoogle? AiLlmEndpointParamsGoogle => _val1; | ||
|
||
public AiLlmEndpointParamsOpenAi? AiLlmEndpointParamsOpenAi => _val2; | ||
|
||
public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsAws value) : base(value) {} | ||
|
||
public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsGoogle value) : base(value) {} | ||
|
||
public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsOpenAi value) : base(value) {} | ||
|
||
public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsAws value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value); | ||
|
||
public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsGoogle value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value); | ||
|
||
public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsOpenAi value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value); | ||
|
||
class AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAiConverter : JsonConverter<AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi> { | ||
public override AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { | ||
using var document = JsonDocument.ParseValue(ref reader); | ||
var discriminant0Present = document.RootElement.TryGetProperty("type", out var discriminant0); | ||
if (discriminant0Present) { | ||
switch (discriminant0.ToString()){ | ||
case "aws_params": | ||
return JsonSerializer.Deserialize<AiLlmEndpointParamsAws>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsAws"); | ||
case "google_params": | ||
return JsonSerializer.Deserialize<AiLlmEndpointParamsGoogle>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsGoogle"); | ||
case "openai_params": | ||
return JsonSerializer.Deserialize<AiLlmEndpointParamsOpenAi>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsOpenAi"); | ||
} | ||
} | ||
throw new Exception($"Discriminant not found in json payload {document.RootElement} while try to converting to type {typeToConvert}"); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? value, JsonSerializerOptions options) { | ||
if (value?.AiLlmEndpointParamsAws != null) { | ||
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsAws, options); | ||
return; | ||
} | ||
if (value?.AiLlmEndpointParamsGoogle != null) { | ||
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsGoogle, options); | ||
return; | ||
} | ||
if (value?.AiLlmEndpointParamsOpenAi != null) { | ||
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsOpenAi, options); | ||
return; | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
...GoogleOrAiLlmEndpointParamsOpenAi/AiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi.cs
This file was deleted.
Oops, something went wrong.