Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 7.18 KB

File metadata and controls

52 lines (36 loc) · 7.18 KB

Dedicated.Embeddings

Overview

Available Operations

embeddings

Creates an embedding vector representing the input text.

Example Usage

import os

from friendli import SyncFriendli

with SyncFriendli(
    token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
    res = friendli.dedicated.embeddings.embeddings(
        model="(endpoint-id)",
        input_="The food was delicious and the waiter...",
        encoding_format="float",
    )

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model str ✔️ ID of target endpoint. If you want to send request to specific adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE". Otherwise, you can just use "YOUR_ENDPOINT_ID" alone. (endpoint-id)
input models.Input ✔️ Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The food was delicious and the waiter...
x_friendli_team OptionalNullable[str] ID of team to run requests as (optional parameter).
encoding_format OptionalNullable[models.EncodingFormat] The format to return the embeddings in. Can be either float or base64.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DedicatedEmbeddingsSuccess

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*