mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-17 09:12:28 +00:00
This PR is part of the documentation revamp. Once the full set of PRs is merged, we’ll publish the combined site to staging for review before updating docs.lancedb.com. Ingestion, search and integration examples are incomplete or inconsistent across languages, and some guidance misstates SDK behavior. This brings the guides and their example sources together. It includes complete Python, TypeScript and Rust workflows, isolated provider and reranker examples, the Superlinked corrections, and guidance on retries that can duplicate writes. Stacked on #4491. Each MDX file has one PR owner. Rebase onto main after #4491 is squash-merged. Local assembly, Mint validation and link checks pass. Example code is unchanged from the previously validated package. Publication stays held through integration.
26 lines
894 B
Plaintext
26 lines
894 B
Plaintext
---
|
|
title: OpenAI
|
|
sidebarTitle: OpenAI
|
|
---
|
|
|
|
import { PyEmbeddingOpenaiBasic } from '/snippets/integrations.mdx';
|
|
|
|
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 | Requested output dimensions for models that support shortening embeddings. Use `func.ndims()` when defining the vector field. |
|
|
| `use_azure` | bool | `False` | Set true to use Azure OpenAI SDK |
|
|
|
|
Set your OpenAI API key before running the example:
|
|
|
|
```shell
|
|
export OPENAI_API_KEY="your-api-key"
|
|
```
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{PyEmbeddingOpenaiBasic}
|
|
</CodeBlock>
|
|
</CodeGroup> |