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

# 嵌入

> 使用 TypeScript SDK 调用 /embeddings。

**方法**：`client.generateEmbedding()`。

### 示例

```typescript theme={null}
const embedding = await client.generateEmbedding({
  model: "openai/text-embedding-3-large",
  input: "Sample text",
});
```

### 关键参数

* `model`（必填）：嵌入模型 ID（例如 `openai/text-embedding-3-large`）。
* `input`（必填）：字符串或字符串数组。
* `encoding_format`：`float`（默认）或 `base64`。
* `dimensions`：用于截短嵌入长度的可选整数（取决于模型）。
* `user`：可选的终端用户标记。

### 返回值

嵌入数据（JSON）

```json theme={null}
{
  "data": [
    {
      "embedding": [0.1, 0.2, 0.3],
      "index": 0
    }
  ],
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}
```


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