Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "c2a365c", "specHash": "6a332e7", "version": "1.9.0" }
{ "engineHash": "c2a365c", "specHash": "4e677e3", "version": "1.9.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ public class AiAgentBasicTextToolBase : ISerializable {
[JsonPropertyName("num_tokens_for_completion")]
public long? NumTokensForCompletion { get; init; }

/// <summary>
/// The parameters for the LLM endpoint specific to OpenAI / Google models.
/// </summary>
[JsonPropertyName("llm_endpoint_params")]
public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi? LlmEndpointParams { get; init; }
public AiLlmEndpointParams? LlmEndpointParams { get; init; }

public AiAgentBasicTextToolBase() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,66 @@
using Box.Sdk.Gen.Internal;

namespace Box.Sdk.Gen.Schemas {
[JsonConverter(typeof(AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAiConverter))]
public class AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi : OneOf<AiLlmEndpointParamsAws, AiLlmEndpointParamsGoogle, AiLlmEndpointParamsOpenAi> {
public AiLlmEndpointParamsAws? AiLlmEndpointParamsAws => _val0;
[JsonConverter(typeof(AiLlmEndpointParamsConverter))]
public class AiLlmEndpointParams : OneOf<AiLlmEndpointParamsOpenAi, AiLlmEndpointParamsGoogle, AiLlmEndpointParamsAws, AiLlmEndpointParamsIbm> {
public AiLlmEndpointParamsOpenAi? AiLlmEndpointParamsOpenAi => _val0;

public AiLlmEndpointParamsGoogle? AiLlmEndpointParamsGoogle => _val1;

public AiLlmEndpointParamsOpenAi? AiLlmEndpointParamsOpenAi => _val2;
public AiLlmEndpointParamsAws? AiLlmEndpointParamsAws => _val2;

public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsAws value) : base(value) {}
public AiLlmEndpointParamsIbm? AiLlmEndpointParamsIbm => _val3;

public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsGoogle value) : base(value) {}
public AiLlmEndpointParams(AiLlmEndpointParamsOpenAi value) : base(value) {}

public AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsOpenAi value) : base(value) {}
public AiLlmEndpointParams(AiLlmEndpointParamsGoogle value) : base(value) {}

public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsAws value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value);
public AiLlmEndpointParams(AiLlmEndpointParamsAws value) : base(value) {}

public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsGoogle value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value);
public AiLlmEndpointParams(AiLlmEndpointParamsIbm value) : base(value) {}

public static implicit operator AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(AiLlmEndpointParamsOpenAi value) => new AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi(value);
public static implicit operator AiLlmEndpointParams(AiLlmEndpointParamsOpenAi value) => new AiLlmEndpointParams(value);

class AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAiConverter : JsonConverter<AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi> {
public override AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
public static implicit operator AiLlmEndpointParams(AiLlmEndpointParamsGoogle value) => new AiLlmEndpointParams(value);

public static implicit operator AiLlmEndpointParams(AiLlmEndpointParamsAws value) => new AiLlmEndpointParams(value);

public static implicit operator AiLlmEndpointParams(AiLlmEndpointParamsIbm value) => new AiLlmEndpointParams(value);

class AiLlmEndpointParamsConverter : JsonConverter<AiLlmEndpointParams> {
public override AiLlmEndpointParams 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");
case "google_params":
return JsonSerializer.Deserialize<AiLlmEndpointParamsGoogle>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsGoogle");
case "aws_params":
return JsonSerializer.Deserialize<AiLlmEndpointParamsAws>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsAws");
case "ibm_params":
return JsonSerializer.Deserialize<AiLlmEndpointParamsIbm>(document) ?? throw new Exception($"Could not deserialize {document} to AiLlmEndpointParamsIbm");
}
}
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);
public override void Write(Utf8JsonWriter writer, AiLlmEndpointParams? value, JsonSerializerOptions options) {
if (value?.AiLlmEndpointParamsOpenAi != null) {
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsOpenAi, options);
return;
}
if (value?.AiLlmEndpointParamsGoogle != null) {
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsGoogle, options);
return;
}
if (value?.AiLlmEndpointParamsOpenAi != null) {
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsOpenAi, options);
if (value?.AiLlmEndpointParamsAws != null) {
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsAws, options);
return;
}
if (value?.AiLlmEndpointParamsIbm != null) {
JsonSerializer.Serialize(writer, value.AiLlmEndpointParamsIbm, options);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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 AiLlmEndpointParamsIbm : ISerializable {
[JsonInclude]
[JsonPropertyName("_istemperatureSet")]
protected bool _isTemperatureSet { get; set; }

[JsonInclude]
[JsonPropertyName("_istop_pSet")]
protected bool _isTopPSet { get; set; }

[JsonInclude]
[JsonPropertyName("_istop_kSet")]
protected bool _isTopKSet { get; set; }

protected double? _temperature { get; set; }

protected double? _topP { get; set; }

protected double? _topK { get; set; }

/// <summary>
/// The type of the AI LLM endpoint params object for IBM.
/// This parameter is **required**.
/// </summary>
[JsonPropertyName("type")]
[JsonConverter(typeof(StringEnumConverter<AiLlmEndpointParamsIbmTypeField>))]
public StringEnum<AiLlmEndpointParamsIbmTypeField> 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; } }

/// <summary>
/// `Top-K` changes how the model selects tokens for output. A `top-K` of 1 means the next selected token is
/// the most probable among all tokens in the model's vocabulary (also called greedy decoding),
/// while a `top-K` of 3 means that the next token is selected from among the three most probable tokens by using temperature.
/// </summary>
[JsonPropertyName("top_k")]
public double? TopK { get => _topK; init { _topK = value; _isTopKSet = true; } }

public AiLlmEndpointParamsIbm(AiLlmEndpointParamsIbmTypeField type = AiLlmEndpointParamsIbmTypeField.IbmParams) {
Type = type;
}

[JsonConstructorAttribute]
internal AiLlmEndpointParamsIbm(StringEnum<AiLlmEndpointParamsIbmTypeField> type) {
Type = AiLlmEndpointParamsIbmTypeField.IbmParams;
}
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);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.ComponentModel;
using Box.Sdk.Gen.Internal;

namespace Box.Sdk.Gen.Schemas {
public enum AiLlmEndpointParamsIbmTypeField {
[Description("ibm_params")]
IbmParams
}
}
Loading