> For the complete documentation index, see [llms.txt](https://help.deepsearch.com/dp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.deepsearch.com/dp/api/chat/function-call.md).

# 딥서치 Function Call

Function Call는 LLM 사용하여 사용자의 자연어 질문들이 딥서치 API 기반으로 변환하여 딥서치에 보유한 기업 데이터를 가져와서 답변 해줍니다.

#### 제공되는 데이터는 다음과 같습니다:

1. [기업 개요 데이터](/dp/api/data/overview.md)
2. [기업 시장 데이터](/dp/api/data/market.md)
3. [문서(뉴스, 공시, IR, 특허 ...) 데이터](/dp/api/data/document.md)

## 딥서치 Function Call

<mark style="color:blue;">`GET`</mark> `https://api.deepsearch.com/note/v1/function`

딥서치 Function Call는 딥서치 API 기반으로 질문합니다.&#x20;

Function Call에서 `company` parameter 있을 경우 이 특정 기업 데이터에서만 질의응답합니다.&#x20;

#### Request Body

| Name                                       | Type    | Description             |
| ------------------------------------------ | ------- | ----------------------- |
| stream                                     | boolean | client에서 결과 stream 여부   |
| question<mark style="color:red;">\*</mark> | String  | 사용자 질문                  |
| history                                    | List    | 챗 히스토리                  |
| company                                    | String  | 특정 기업 코드. Ex: KRX:00040 |

{% tabs %}
{% tab title="200: OK 성공" %}

```json
{
    "index": 0,
    "message": {
        "role": "assistant",
        "content": "{{답변}}"
    },
    "finish_reason": "stop"
}
```

{% endtab %}

{% tab title="200: OK stream = True 성공" %}
GPT처럼 [Server Sent Event (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format)으로 데이터 받기.

```
data: 

data: 삼

data: 성

data: 전

data: 자

data: 의

data:  매
........
........
```

{% endtab %}

{% tab title="404: Not Found 답변 없음" %}

```json
{
    "detail": {
        "code": 70001,
        "msg": "no_answer_found"
    }
}
```

{% endtab %}
{% endtabs %}

## 딥서치 Function Call

<mark style="color:green;">`POST`</mark> `https://api.deepsearch.com/note/v1/function`

딥서치 Function Call는 딥서치 API 기반으로 질문합니다.&#x20;

Function Call에서 `company` parameter 있을 경우 이 특정 기업 데이터에서만 질의응답합니다.&#x20;

#### Request Body

| Name                                       | Type    | Description             |
| ------------------------------------------ | ------- | ----------------------- |
| stream                                     | boolean | client에서 결과 stream 여부   |
| question<mark style="color:red;">\*</mark> | String  | 사용자 질문                  |
| history                                    | List    | 챗 히스토리                  |
| company                                    | String  | 특정 기업 코드. Ex: KRX:00040 |

{% tabs %}
{% tab title="200: OK 성공" %}

```json
{
    "index": 0,
    "message": {
        "role": "assistant",
        "content": "{{답변}}"
    },
    "finish_reason": "stop"
}
```

{% endtab %}

{% tab title="200: OK stream = True 성공" %}
GPT처럼 [Server Sent Event (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format)으로 데이터 받기.

```
data: 

data: 삼

data: 성

data: 전

data: 자

data: 의

data:  매
........
........
```

{% endtab %}

{% tab title="404: Not Found 답변 없음" %}

```json
{
    "detail": {
        "code": 70001,
        "msg": "no_answer_found"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.deepsearch.com/dp/api/chat/function-call.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
