Skip to main content
NagaAI supports two embedding output encodings:
  • float for directly usable JSON arrays
  • base64 for more compact transport or custom binary decoding workflows
Use float unless you have a specific reason to optimize transport size or handle your own decoding path.

Format comparison

FormatBest for
floatdirect use in application code, quick debugging, JSON-first workflows
base64lower payload size, custom binary pipelines, delayed decoding

Float Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.naga.ac/v1",
    api_key="YOUR_API_KEY",
)

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="hello world",
    encoding_format="float",
)

print(type(response.data[0].embedding))

Base64 Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.naga.ac/v1",
    api_key="YOUR_API_KEY",
)

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="hello world",
    encoding_format="base64",
)

print(response.data[0].embedding)