Skip to main content

Router.Embeddings

Create an Embedding

Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.router.embeddings.create(input=[
        "The food was delicious",
        "And the waiter was friendly",
    ], model="openai/text-embedding-3-small", orq={
        "identity": {
            "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
            "display_name": "Jane Doe",
            "email": "jane.doe@example.com",
            "metadata": [
                {
                    "department": "Engineering",
                    "role": "Senior Developer",
                },
            ],
            "logo_url": "https://example.com/avatars/jane-doe.jpg",
            "tags": [
                "hr",
                "engineering",
            ],
        },
    })

    # Handle response
    print(res)