using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Yi.Framework.AiHub.Domain.Shared.Dtos.OpenAi.Embeddings; //TODO add model validation //TODO check what is string or array for prompt,.. public record EmbeddingCreateRequest { /// /// Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs /// in a single request, pass an array of strings or array of token arrays. Each input must not exceed 2048 tokens in /// length. /// Unless your are embedding code, we suggest replacing newlines (`\n`) in your input with a single space, as we have /// observed inferior results when newlines are present. /// /// [JsonIgnore] public List? InputAsList { get; set; } /// /// Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs /// in a single request, pass an array of strings or array of token arrays. Each input must not exceed 2048 tokens in /// length. /// Unless your are embedding code, we suggest replacing newlines (`\n`) in your input with a single space, as we have /// observed inferior results when newlines are present. /// /// [JsonIgnore] public string? Input { get; set; } [JsonPropertyName("input")] public IList? InputCalculated { get { if (Input != null && InputAsList != null) { throw new ValidationException( "Input and InputAsList can not be assigned at the same time. One of them is should be null."); } if (Input != null) { return new List { Input }; } return InputAsList; } } /// /// ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your /// available models, or see our [Model overview](/docs/models/overview) for descriptions of them. /// /// [JsonPropertyName("model")] public string? Model { get; set; } /// /// The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models. /// /// [JsonPropertyName("dimensions")] public int? Dimensions { get; set; } /// /// The format to return the embeddings in. Can be either float or base64. /// /// [JsonPropertyName("encoding_format")] public string? EncodingFormat { get; set; } public IEnumerable Validate() { throw new NotImplementedException(); } }