-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathIEmbeddingEndpoint.cs
More file actions
46 lines (41 loc) · 2.43 KB
/
IEmbeddingEndpoint.cs
File metadata and controls
46 lines (41 loc) · 2.43 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
using OpenAI_API.Models;
using System.Threading.Tasks;
namespace OpenAI_API.Embedding
{
/// <summary>
/// An interface for <see cref="EmbeddingEndpoint"/>, for ease of mock testing, etc
/// </summary>
public interface IEmbeddingEndpoint
{
/// <summary>
/// This allows you to send request to the recommended model without needing to specify. Every request uses the <see cref="Model.AdaTextEmbedding"/> model
/// </summary>
EmbeddingRequest DefaultEmbeddingRequestArgs { get; set; }
/// <summary>
/// Ask the API to embedd text using the default embedding model <see cref="Model.AdaTextEmbedding"/>
/// </summary>
/// <param name="input">Text to be embedded</param>
/// <param name="model">Embeddings model to be used</param>
/// <returns>Asynchronously returns the embedding result. Look in its <see cref="Data.Embedding"/> property of <see cref="EmbeddingResult.Data"/> to find the vector of floating point numbers</returns>
Task<EmbeddingResult> CreateEmbeddingAsync(string input, Model model = null);
/// <summary>
/// Ask the API to embedd text using a custom request
/// </summary>
/// <param name="request">Request to be send</param>
/// <returns>Asynchronously returns the embedding result. Look in its <see cref="Data.Embedding"/> property of <see cref="EmbeddingResult.Data"/> to find the vector of floating point numbers</returns>
Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request);
/// <summary>
/// Ask the API to embedd text using the default embedding model <see cref="Model.AdaTextEmbedding"/> in case no other model is specified
/// </summary>
/// <param name="input">Text to be embedded</param>
/// <param name="model">Embeddings model to be used</param>
/// <returns>Asynchronously returns the first embedding result as an array of floats.</returns>
Task<float[]> GetEmbeddingsAsync(string input, Model model = null);
/// <summary>
/// Ask the API to embedd text using the default embedding model <see cref="Model.AdaTextEmbedding"/> in case no other model is specified
/// </summary>
/// <param name="request">Request to be send</param>
/// <returns>Asynchronously returns the first embedding result as an array of floats.</returns>
Task<float[]> GetEmbeddingsAsync(EmbeddingRequest request);
}
}