Table of Contents

Class PerplexityContextualizedEmbeddingProvider

Namespace
Mythosia.AI.Rag.Embeddings
Assembly
Mythosia.AI.Rag.dll
public sealed class PerplexityContextualizedEmbeddingProvider : IRetrievalEmbeddingProvider, IEmbeddingProvider
Inheritance
PerplexityContextualizedEmbeddingProvider
Implements
Inherited Members

Constructors

PerplexityContextualizedEmbeddingProvider(string, HttpClient, string, int?)

public PerplexityContextualizedEmbeddingProvider(string apiKey, HttpClient httpClient, string model = "pplx-embed-context-v1-0.6b", int? dimensions = null)

Parameters

apiKey string
httpClient HttpClient
model string
dimensions int?

Properties

Dimensions

public int Dimensions { get; }

Property Value

int

Model

public string Model { get; }

Property Value

string

Methods

GetBinaryDocumentEmbeddingsAsync(IEnumerable<IEnumerable<string>>, CancellationToken)

public Task<IReadOnlyList<IReadOnlyList<PerplexityBinaryEmbedding>>> GetBinaryDocumentEmbeddingsAsync(IEnumerable<IEnumerable<string>> documentChunks, CancellationToken cancellationToken = default)

Parameters

documentChunks IEnumerable<IEnumerable<string>>
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<IReadOnlyList<PerplexityBinaryEmbedding>>>

GetBinaryQueryEmbeddingAsync(string, CancellationToken)

public Task<PerplexityBinaryEmbedding> GetBinaryQueryEmbeddingAsync(string query, CancellationToken cancellationToken = default)

Parameters

query string
cancellationToken CancellationToken

Returns

Task<PerplexityBinaryEmbedding>

GetDocumentEmbeddingsAsync(IEnumerable<IEnumerable<string>>, CancellationToken)

public Task<IReadOnlyList<IReadOnlyList<float[]>>> GetDocumentEmbeddingsAsync(IEnumerable<IEnumerable<string>> documentChunks, CancellationToken cancellationToken = default)

Parameters

documentChunks IEnumerable<IEnumerable<string>>
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<IReadOnlyList<float[]>>>

GetEmbeddingAsync(string, CancellationToken)

public Task<float[]> GetEmbeddingAsync(string text, CancellationToken cancellationToken = default)

Parameters

text string
cancellationToken CancellationToken

Returns

Task<float[]>

GetEmbeddingsAsync(IEnumerable<string>, CancellationToken)

public Task<IReadOnlyList<float[]>> GetEmbeddingsAsync(IEnumerable<string> texts, CancellationToken cancellationToken = default)

Parameters

texts IEnumerable<string>
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<float[]>>

GetQueryEmbeddingAsync(string, CancellationToken)

public Task<float[]> GetQueryEmbeddingAsync(string query, CancellationToken cancellationToken = default)

Parameters

query string
cancellationToken CancellationToken

Returns

Task<float[]>