Skip to content

Commit a5702a1

Browse files
committed
#49 IMPLEMENT IEmbeddingEndpoint
1 parent f709a5a commit a5702a1

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

OpenAI_API/Embedding/EmbeddingEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace OpenAI_API.Embedding
66
/// <summary>
77
/// OpenAI’s text embeddings measure the relatedness of text strings by generating an embedding, which is a vector (list) of floating point numbers. The distance between two vectors measures their relatedness. Small distances suggest high relatedness and large distances suggest low relatedness.
88
/// </summary>
9-
public class EmbeddingEndpoint : EndpointBase
9+
public class EmbeddingEndpoint : EndpointBase, IEmbeddingEndpoint
1010
{
1111
/// <summary>
1212
/// This allows you to send request to the recommended model without needing to specify. Every request uses the <see cref="Model.AdaTextEmbedding"/> model
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Threading.Tasks;
2+
3+
namespace OpenAI_API.Embedding
4+
{
5+
/// <summary>
6+
/// OpenAI’s text embeddings measure the relatedness of text strings by generating an embedding, which is a vector (list) of floating point numbers. The distance between two vectors measures their relatedness. Small distances suggest high relatedness and large distances suggest low relatedness.
7+
/// </summary>
8+
public interface IEmbeddingEndpoint
9+
{
10+
/// <summary>
11+
/// This allows you to send request to the recommended model without needing to specify. Every request uses the <see cref="Model.AdaTextEmbedding"/> model
12+
/// </summary>
13+
EmbeddingRequest DefaultEmbeddingRequestArgs { get; set; }
14+
15+
/// <summary>
16+
/// Ask the API to embedd text using the default embedding model <see cref="Model.AdaTextEmbedding"/>
17+
/// </summary>
18+
/// <param name="input">Text to be embedded</param>
19+
/// <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>
20+
Task<EmbeddingResult> CreateEmbeddingAsync(string input);
21+
22+
/// <summary>
23+
/// Ask the API to embedd text using a custom request
24+
/// </summary>
25+
/// <param name="request">Request to be send</param>
26+
/// <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>
27+
Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request);
28+
29+
/// <summary>
30+
/// Ask the API to embedd text using the default embedding model <see cref="Model.AdaTextEmbedding"/>
31+
/// </summary>
32+
/// <param name="input">Text to be embedded</param>
33+
/// <returns>Asynchronously returns the first embedding result as an array of floats.</returns>
34+
Task<float[]> GetEmbeddingsAsync(string input);
35+
}
36+
}

0 commit comments

Comments
 (0)