Search Results for

    Show / Hide Table of Contents

    Class OpenAIEmbeddings

    Embeddings client for OpenAI

    Inheritance
    object
    OpenAIEmbeddings
    Implements
    IEmbeddings
    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 Source

    OpenAIEmbeddings(IConfiguration)

    Declaration
    public OpenAIEmbeddings(IConfiguration configuration)
    Parameters
    Type Name Description
    IConfiguration configuration
    | Improve this Doc View Source

    OpenAIEmbeddings(string)

    Default constructor

    Declaration
    public OpenAIEmbeddings(string openAiKey)
    Parameters
    Type Name Description
    string openAiKey

    Properties

    | Improve this Doc View Source

    BatchSize

    Size of the batch

    Declaration
    public int BatchSize { get; init; }
    Property Value
    Type Description
    int
    Remarks

    Default is 20

    | Improve this Doc View Source

    MaxTokens

    Declaration
    public int MaxTokens { get; init; }
    Property Value
    Type Description
    int

    Methods

    | Improve this Doc View Source

    EmbedAsync(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>>
    | Improve this Doc View Source

    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>

    Implements

    IEmbeddings
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright 2023 © Pavel «xakpc» Osadchuk for DotnetPrompt