Spaces:
Paused
Paused
File size: 1,093 Bytes
9792ea7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # -*- coding: utf-8 -*-
"""The embedding response class."""
from dataclasses import dataclass, field
from typing import Literal, List
from ._embedding_usage import EmbeddingUsage
from .._utils._common import _get_timestamp
from .._utils._mixin import DictMixin
from ..types import Embedding
@dataclass
class EmbeddingResponse(DictMixin):
"""The embedding response class."""
embeddings: List[Embedding]
"""The embedding data"""
id: str = field(default_factory=lambda: _get_timestamp(True))
"""The identity of the embedding response"""
created_at: str = field(default_factory=_get_timestamp)
"""The timestamp of the embedding response creation"""
type: Literal["embedding"] = field(default_factory=lambda: "embedding")
"""The type of the response, must be `embedding`."""
usage: EmbeddingUsage | None = field(default_factory=lambda: None)
"""The usage of the embedding model API invocation, if available."""
source: Literal["cache", "api"] = field(default_factory=lambda: "api")
"""If the response comes from the cache or the API."""
|