main
 1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 2
 3from __future__ import annotations
 4
 5from typing import Union, Iterable
 6from typing_extensions import Literal, Required, TypedDict
 7
 8from .._types import SequenceNotStr
 9from .embedding_model import EmbeddingModel
10
11__all__ = ["EmbeddingCreateParams"]
12
13
14class EmbeddingCreateParams(TypedDict, total=False):
15    input: Required[Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]]]
16    """Input text to embed, encoded as a string or array of tokens.
17
18    To embed multiple inputs in a single request, pass an array of strings or array
19    of token arrays. The input must not exceed the max input tokens for the model
20    (8192 tokens for all embedding models), cannot be an empty string, and any array
21    must be 2048 dimensions or less.
22    [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
23    for counting tokens. In addition to the per-input token limit, all embedding
24    models enforce a maximum of 300,000 tokens summed across all inputs in a single
25    request.
26    """
27
28    model: Required[Union[str, EmbeddingModel]]
29    """ID of the model to use.
30
31    You can use the
32    [List models](https://platform.openai.com/docs/api-reference/models/list) API to
33    see all of your available models, or see our
34    [Model overview](https://platform.openai.com/docs/models) for descriptions of
35    them.
36    """
37
38    dimensions: int
39    """The number of dimensions the resulting output embeddings should have.
40
41    Only supported in `text-embedding-3` and later models.
42    """
43
44    encoding_format: Literal["float", "base64"]
45    """The format to return the embeddings in.
46
47    Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
48    """
49
50    user: str
51    """
52    A unique identifier representing your end-user, which can help OpenAI to monitor
53    and detect abuse.
54    [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
55    """