# 概述

文本嵌入的定义和应用 Afarensis的文本嵌入是一种将文本字符串转换为数字向量的技术，广泛应用于多种场景，包括搜索、聚类分析、推荐系统、异常检测、多样性测量和分类。这些向量之间的距离用于衡量文本之间的相关性，其中较小的距离表示高度相关，而较大的距离表示低相关性。

如何获取文本嵌入 要获得文本嵌入，需要将文本字符串和嵌入模型的名称（例如text-embedding-3-small）发送到Afarensis的嵌入API端点。API会返回包含嵌入向量的响应，该向量可以用于后续的数据分析或其他应用场景。

示例：获取文本嵌入 curl <https://api.afarensis.com/v1/embeddings\\>
-H "Content-Type: application/json"\
-H "Authorization: Bearer $AFARENSIS\_API\_KEY"\
-d '{ "input": "Your text string goes here", "model": "text-embedding-3-small" }' 这个请求会返回一个包含嵌入向量和一些额外元数据的响应。

嵌入响应示例 { "object": "list", "data": \[ { "object": "embedding", "index": 0, "embedding": \[ -0.006929283495992422, -0.005336422007530928, ... (省略以节省空间) ... -4.547132266452536e-05, -0.024047505110502243 ] } ], "model": "text-embedding-3-small", "usage": { "prompt\_tokens": 5, "total\_tokens": 5 } } 默认情况下，text-embedding-3-small模型的嵌入向量长度为1536，而text-embedding-3-large模型的长度为3072。可以通过传递dimensions参数来调整嵌入的维度，以适应不同的应用需求。

嵌入定价 嵌入的定价基于输入中的令牌数量。更多定价信息，请访问Afarensis的定价页面。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.afarensis.com/qian-ru/gai-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
