//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace Microsoft.Azure.Cosmos { using System; using System.Collections.Generic; /// /// The result of a call to . /// Carries the generated float32 vectors plus optional diagnostic fields (token usage, /// latency) the SDK surfaces through CosmosDiagnostics. /// #if PREVIEW public #else internal #endif sealed class CosmosEmbeddingResult { /// /// Initializes a new instance of . /// /// /// The generated float32 embedding vectors, one per input string supplied to the /// originating call, /// in the same order as the inputs. /// /// /// Optional total token count consumed by the embedding service to produce these vectors. /// Pass null when the underlying service does not report token usage. /// /// /// Optional duration the implementation observed for the embedding service call (for /// example, the wall-clock time around the underlying HTTP request). Surfaced through /// CosmosDiagnostics for query-time observability. Pass null when the /// implementation does not measure latency. /// public CosmosEmbeddingResult( IReadOnlyList> vectors, int? totalTokens = null, TimeSpan? latency = null) { this.Vectors = vectors ?? throw new ArgumentNullException(nameof(vectors)); this.TotalTokens = totalTokens; this.Latency = latency; } /// /// Gets the generated float32 embedding vectors, one per input string, in the same /// order as the inputs supplied to . /// public IReadOnlyList> Vectors { get; } /// /// Gets the total number of tokens the embedding service consumed to generate /// , or null when the underlying service does not report it. /// public int? TotalTokens { get; } /// /// Gets the duration the implementation observed for the underlying embedding service /// call, or null when the implementation does not measure it. Surfaced through /// CosmosDiagnostics for query-time observability. /// public TimeSpan? Latency { get; } } }