-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathEmbeddingRequest.cs
More file actions
64 lines (56 loc) · 2.08 KB
/
EmbeddingRequest.cs
File metadata and controls
64 lines (56 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using Newtonsoft.Json;
using OpenAI_API.Models;
namespace OpenAI_API.Embedding
{
/// <summary>
/// Represents a request to the Completions API. Matches with the docs at <see href="https://platform.openai.com/docs/api-reference/embeddings">the OpenAI docs</see>
/// </summary>
public class EmbeddingRequest
{
/// <summary>
/// ID of the model to use. You can use <see cref="ModelsEndpoint.GetModelsAsync()"/> to see all of your available models, or use a standard model like <see cref="Model.AdaTextEmbedding"/>.
/// </summary>
[JsonProperty("model")]
public string Model { get; set; }
/// <summary>
/// Main text to be embedded
/// </summary>
[JsonProperty("input")]
public string Input { get; set; }
/// <summary>
/// The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
/// </summary>
[JsonProperty("dimensions")]
public int? Dimensions { get; set; }
/// <summary>
/// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
/// </summary>
[JsonProperty("user")]
public string User { get; set; }
/// <summary>
/// Cretes a new, empty <see cref="EmbeddingRequest"/>
/// </summary>
public EmbeddingRequest()
{
}
/// <summary>
/// Creates a new <see cref="EmbeddingRequest"/> with the specified parameters
/// </summary>
/// <param name="model">The model to use. You can use <see cref="ModelsEndpoint.GetModelsAsync()"/> to see all of your available models, or use a standard model like <see cref="Model.AdaTextEmbedding"/>.</param>
/// <param name="input">The prompt to transform</param>
public EmbeddingRequest(Model model, string input)
{
Model = model;
this.Input = input;
}
/// <summary>
/// Creates a new <see cref="EmbeddingRequest"/> with the specified input and the <see cref="Model.AdaTextEmbedding"/> model.
/// </summary>
/// <param name="input">The prompt to transform</param>
public EmbeddingRequest(string input)
{
Model = OpenAI_API.Models.Model.AdaTextEmbedding;
this.Input = input;
}
}
}