openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Embeddings/EmbeddingGenerationOptions.cs
97lines · modecode
| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | |
| 4 | namespace OpenAI.Embeddings; |
| 5 | |
| 6 | [CodeGenModel("CreateEmbeddingRequest")] |
| 7 | [CodeGenSuppress("EmbeddingGenerationOptions", typeof(BinaryData), typeof(InternalCreateEmbeddingRequestModel))] |
| 8 | public partial class EmbeddingGenerationOptions |
| 9 | { |
| 10 | // CUSTOM: |
| 11 | // - Made internal. This value comes from a parameter on the client method. |
| 12 | // - Added setter. |
| 13 | /// <summary> |
| 14 | /// Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a |
| 15 | /// single request, pass an array of strings or array of token arrays. Each input must not exceed |
| 16 | /// the max input tokens for the model (8191 tokens for `text-embedding-ada-002`) and cannot be an |
| 17 | /// empty string. |
| 18 | /// [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) |
| 19 | /// for counting tokens. |
| 20 | /// <para> |
| 21 | /// To assign an object to this property use <see cref="BinaryData.FromObjectAsJson{T}(T, System.Text.Json.JsonSerializerOptions?)"/>. |
| 22 | /// </para> |
| 23 | /// <para> |
| 24 | /// To assign an already formatted json string to this property use <see cref="BinaryData.FromString(string)"/>. |
| 25 | /// </para> |
| 26 | /// <para> |
| 27 | /// <remarks> |
| 28 | /// Supported types: |
| 29 | /// <list type="bullet"> |
| 30 | /// <item> |
| 31 | /// <description><see cref="string"/></description> |
| 32 | /// </item> |
| 33 | /// <item> |
| 34 | /// <description><see cref="IList{T}"/> where <c>T</c> is of type <see cref="string"/></description> |
| 35 | /// </item> |
| 36 | /// <item> |
| 37 | /// <description><see cref="IList{T}"/> where <c>T</c> is of type <see cref="long"/></description> |
| 38 | /// </item> |
| 39 | /// <item> |
| 40 | /// <description><see cref="IList{T}"/> where <c>T</c> is of type <c>IList{long}</c></description> |
| 41 | /// </item> |
| 42 | /// </list> |
| 43 | /// </remarks> |
| 44 | /// Examples: |
| 45 | /// <list type="bullet"> |
| 46 | /// <item> |
| 47 | /// <term>BinaryData.FromObjectAsJson("foo")</term> |
| 48 | /// <description>Creates a payload of "foo".</description> |
| 49 | /// </item> |
| 50 | /// <item> |
| 51 | /// <term>BinaryData.FromString("\"foo\"")</term> |
| 52 | /// <description>Creates a payload of "foo".</description> |
| 53 | /// </item> |
| 54 | /// <item> |
| 55 | /// <term>BinaryData.FromObjectAsJson(new { key = "value" })</term> |
| 56 | /// <description>Creates a payload of { "key": "value" }.</description> |
| 57 | /// </item> |
| 58 | /// <item> |
| 59 | /// <term>BinaryData.FromString("{\"key\": \"value\"}")</term> |
| 60 | /// <description>Creates a payload of { "key": "value" }.</description> |
| 61 | /// </item> |
| 62 | /// </list> |
| 63 | /// </para> |
| 64 | /// </summary> |
| 65 | internal BinaryData Input { get; set; } |
| 66 | |
| 67 | // CUSTOM: |
| 68 | // - Made internal. The model is specified by the client. |
| 69 | // - Added setter. |
| 70 | /// <summary> |
| 71 | /// ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to |
| 72 | /// see all of your available models, or see our [Model overview](/docs/models/overview) for |
| 73 | /// descriptions of them. |
| 74 | /// </summary> |
| 75 | internal InternalCreateEmbeddingRequestModel Model { get; set; } |
| 76 | |
| 77 | // CUSTOM: Made internal. We always request the embedding as a base64-encoded string for better performance. |
| 78 | /// <summary> |
| 79 | /// The format to return the embeddings in. Can be either `float` or |
| 80 | /// [`base64`](https://pypi.org/project/pybase64/). |
| 81 | /// </summary> |
| 82 | internal InternalCreateEmbeddingRequestEncodingFormat? EncodingFormat { get; set; } |
| 83 | |
| 84 | // CUSTOM: Made public now that there are no required properties. |
| 85 | /// <summary> Initializes a new instance of <see cref="EmbeddingGenerationOptions"/>. </summary> |
| 86 | public EmbeddingGenerationOptions() |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | // CUSTOM: Renamed. |
| 91 | /// <summary> |
| 92 | /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. |
| 93 | /// <see href="https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids">Learn more</see>. |
| 94 | /// </summary> |
| 95 | [CodeGenMember("User")] |
| 96 | public string EndUserId { get; set; } |
| 97 | } |