Class OpenAIEmbeddings
Embeddings client for OpenAI
Inheritance
object
OpenAIEmbeddings
Implements
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotnetPrompt.LLM.OpenAI
Assembly: DotnetPrompt.LLM.OpenAI.dll
Syntax
public class OpenAIEmbeddings : IEmbeddings
Constructors
| Improve this Doc View SourceOpenAIEmbeddings(IConfiguration)
Declaration
public OpenAIEmbeddings(IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | configuration |
OpenAIEmbeddings(string)
Default constructor
Declaration
public OpenAIEmbeddings(string openAiKey)
Parameters
Type | Name | Description |
---|---|---|
string | openAiKey |
Properties
| Improve this Doc View SourceBatchSize
Size of the batch
Declaration
public int BatchSize { get; init; }
Property Value
Type | Description |
---|---|
int |
Remarks
Default is 20
MaxTokens
Declaration
public int MaxTokens { get; init; }
Property Value
Type | Description |
---|---|
int |
Methods
| Improve this Doc View SourceEmbedAsync(IList<string>)
Call out to OpenAI's embedding endpoint for embedding search docs.
Declaration
public Task<IList<TextEmbedding>> EmbedAsync(IList<string> texts)
Parameters
Type | Name | Description |
---|---|---|
IList<string> | texts |
Returns
Type | Description |
---|---|
Task<IList<TextEmbedding>> |
EmbedAsync(string)
Call OpenAI embeddings to embed a single text
Declaration
public Task<TextEmbedding> EmbedAsync(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text |
Returns
Type | Description |
---|---|
Task<TextEmbedding> |