> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI

LanceDB registers the OpenAI embeddings function in the registry by default, as `openai`. Below are the parameters that you can customize when creating the instances:

| Parameter | Type | Default Value | Description |
| - | - | - | - |
| `name` | `str` | `"text-embedding-ada-002"` | The name of the model. |
| `dim` | `int` | Model default | For OpenAI's newer text-embedding-3 model, we can specify a dimensionality that is smaller than the 1536 size. This feature supports it |
| `use_azure` | bool | `False` | Set true to use Azure OpenAI SDK |

import tempfile
from pathlib import Path

import lancedb
from lancedb.embeddings import get\_registry
from lancedb.pydantic import LanceModel, Vector

db\_path = Path(tempfile.mkdtemp()) / "openai-embeddings"
db = lancedb.connect(str(db\_path))
func = get\_registry().get("openai").create(name="text-embedding-ada-002")

class Words(LanceModel):
&#x20;   text: str = func.SourceField()
&#x20;   vector: Vector(func.ndims()) = func.VectorField()

table = db.create\_table("words", schema=Words, mode="overwrite")
table.add(
&#x20;   \[
&#x20;       \{"text": "hello world"},
&#x20;       \{"text": "goodbye world"},
&#x20;   ]
)

query = "greetings"
actual = table.search(query).limit(1).to\_pydantic(Words)\[0]
print(actual.text)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.