# 資料參考搜尋

此 API 用於在指定的知識版本中，搜尋相關的參考資料。

```javascript
curl -X 'POST' \
  'http://127.0.0.1:8000/v1/chat/references?fileset_id={fileset_id}&query={query}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'
```

#### Request Headers

| **Key** | **Value** |
| --- | --- |
| Request Method | POST |
| accept | application/json |
| Authorization | Bearer &lt;your-api-key> |
| Content-Type | application/json |

#### Query Parameters

| **Field** | **Type** | **Note** | **Required** |
| --- | --- | --- | --- |
| fileset_id | string | 知識版本的唯一鍵，uuid | true |
| query | string | 搜尋的內容 | true |

#### Response Body

```javascript
[
  {
    "id": "c7ea032b-eb16-4ccb-94a6-88af66db5d22",
    "metadata": {
      "file_id": "e2a26cf8-6618-4738-98b0-80520fa19b2c",
      "filename": "The Pragmatic Programmer.pdf",
      "filetype": "text/plain",
      "start_index": 0,
      "end_index": 0,
      "_distance": 0.7463585138320923,
      "score": 0.2536414861679077,
      "relevance_score": 0.40771484375,
      "rerank_logit": -3.736328125
    },
    "page_content": "Filename: The Pragmatic Programmer.pdf\n\n\n...",
    "type": "Document"
  }
]
```

**Field Explanation**

| **Field** | **Detail** |
| --- | --- |
| [] | 搜尋到的資料列表 |
| [].id | 資料的唯一鍵，uuid |
| [].metadata | 資料的描述內容 |
| [].metadata.file_id | 檔案的唯一鍵，uuid |
| [].metadata.filename | 檔案的名稱 |
| [].metadata.filetype | 檔案的種類 |
| [].metadata.start_index | 相關段落的起始位置 |
| [].metadata.end_index | 相關段落的結束位置 |
| [].metadata._distance | (與 OpenAI 相容而保留) |
| [].metadata.score | (與 OpenAI 相容而保留) |
| [].metadata.relevance_score | (與 OpenAI 相容而保留) |
| [].metadata.rerank_logit | (與 OpenAI 相容而保留) |
| [].page_content | 相關段落的內容 |
| [].type | (與 OpenAI 相容而保留) |
