시작하기
home
기본 개념
home

API v1 가이드

[1] 기능소개

이 문서는 API를 이용하여 STORM의 채팅 기능을 구현하는 방법을 안내합니다.

[2] 요청

기본 정보

메서드
URL
인증 방식
POST
STORM 어드민의 API key

Request Header

이름
필수
설명
storm-api-key
O
STORM 어드민의 API key를 담습니다. API key는 STORM 어드민의 채널연동 화면에서 확인하실 수 있습니다.

Request Body

이름
타입
필수
설명
예시
question
string
O
유저의 질문을 해당 필드에 담습니다.
“안녕하세요”
bucketIds
array of strings
X
탐색할 폴더를 지정하고 싶은 경우에 사용합니다. 탐색하고자 하는 폴더의 id를 담습니다. 해당 필드가 비어있을 경우 모든 폴더를 대상으로 탐색합니다.
[’123454321’, ‘23423243’]
isStreaming
boolean
X
스트리밍 여부를 선택합니다. 해당 필드가 지어있을 경우 기본값은 FALSE로 동작합니다.
true
webhookUrl
string
X
채팅의 답변에 대한 응답을 받을 콜백 URL을 입력합니다. isStreaming 필드가 false일 경우에만 동작합니다.
https://example.webhook-sionic.com
threadId
string
X
채팅을 전송할 스레드 ID를 담습니다. 입력한 스레드 ID에 이어서 멀티턴으로 대화를 진행할 수 있습니다. 스레드 ID를 입력하지 않는 경우, 새로운 스레드를 내부적으로 생성합니다. 이때, 생성된 새로운 스레드 ID는 응답으로 담기게됩니다.
12341234
extra
json
X
유동적으로 추가적인 정보나 설정을 입력할 수 있는 자유로운 객체 타입의 필드로, 다양한 데이터 타입의 값을 담을 수 있습니다. RAG 쿼리 또는 프롬프트에 동적으로 내용을 추가하고자 할 때 활용됩니다.
{ 'price': 4000, 'items': ['icecream', 'salad'] }

Request Body 예제

Java
JavaScript
Python

[3] 응답

Response Body 예제

Request 시 isStreamingfalse 로 지정한 경우
이름
타입
설명
예시
id
string
채팅 ID
5186900060102037504
question
string
유저의 질문
안녕하세요!
answer
string | null
LLM 답변 (null) 지정한 webhookUrl 로 전달되는 데이터에서 LLM 답변을 확인할 수 있습니다.
null
createdAt
string (ISO8601)
채팅 생성 일자 (질문 생성 일자)
2024-05-14T10:19:49.274Z
updatedAt
string (ISO8601)
채팅 수정 일자 (일반적으로 LLM 답변 생성 일자)
2024-05-14T10:19:58.274Z
thread
object
채팅 스레드
true
thread.id
string
채팅 스레드 ID
https://example.webhook-sionic.com
thread.createdAt
string (ISO8601)
채팅 스레드 생성 일자
2024-05-14T10:19:48.274Z
thread.updatedAt
string (ISO8601)
채팅 스레드 수정 일자
2024-05-14T10:19:48.274Z
// HTTP 1.1 application/json { "status": "success", "data": { "id": "5186900060102037504", "question": "안녕하세요!", "answer": null, "createdAt": "2024-05-14T10:19:53.274Z", "updatedAt": "2024-05-14T10:19:53.274Z", "thread": { "id": "12341234", "createdAt": "2024-05-14T10:19:48.274Z", "updatedAt": "2024-05-14T10:19:48.274Z", } } }
JSON
복사
지정한 webhookUrl 로 전송되는 응답
이름
타입
설명
예시
chatId
string
채팅 ID
5186900060102037504
question
string
유저의 질문
안녕하세요!
answer
string
LLM 답변 지정한 webhookUrl 로 전달되는 데이터에서 LLM 답변을 확인할 수 있습니다.
안녕하세요! 어떤 질문이나 도움이 필요하신가요?
createdAt
string (ISO8601)
채팅 생성 일자 (질문 생성 일자)
2024-05-14T10:19:49.274Z
updatedAt
string (ISO8601)
채팅 수정 일자 (일반적으로 LLM 답변 생성 일자)
2024-05-14T10:19:58.274Z
noRelevantKnowledge
boolean
응답에 실패했을때 원인을 파악하기 위한 flag 연관 지식이 없어서 응답에 실패한 경우 true, 기타 내부 오류로 응답에 실패한 경우 false 를 return 합니다. 응답에 성공한 경우에도 false 를 리턴합니다. (default)
true
contexts
array of object
LLM 답변을 위해 참고한 청크들
contexts.type
string
청크가 존재하는 지식의 타입. document 또는 feedback
document
contexts.bucketName
string
청크가 존재하는 지식이 속한 bucket 이름
test
contexts.fileName
string
청크가 존재하는 지식명
gnu-c-manual.pdf
contexts.pageName
string
청크가 존재하는 페이지 만약 여러 페이지에 걸쳐있다면, , 로 구분합니다.
90
contexts.context
string
청크
. . . . . . . . . 62 functions, static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 I identifiers . . . . . . . . . . . . . . . .
contexts.referenceIdx
number
LLM 답변에 [1] 과 같은 형태로 표시될때 쓰이는 context의 Idx 정보 LLM 답변에서 [referenceIdx + 1] 형태로 표시됩니다.
0
{ "eventType": "create-chat", "data": { "chatId": "5186900060102037504", "question": "안녕하세요!", "answer": "안녕하세요! 어떤 질문이나 도움이 필요하신가요?", "createdAt": "2024-05-16T05:50:26.084Z", "updatedAt": "2024-05-16T05:50:28.619Z", "noRelevantKnowledge": false, "contexts": [ { "type": "document", "bucketName": "test", "fileName": "gnu-c-manual.pdf", "pageName": "90", "context": ". . . . . . . . . 62 functions, static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 G goto statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 H hello program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 hello.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 I identifiers . . . . . . . . . . . . . . . .", "referenceIdx": 0 } ] } }
JSON
복사
Request 시 isStreamingtrue 로 지정한 경우
마지막 response 인 경우 ( is_final_event: false 인 경우)
이름
타입
설명
예시
id
string
여러 response들 중에서 response를 특정하기 위한 ID
0690af57-ac3e-495e-8a31-a680588be970
event_id
number
하나의 response 에서 순서를 특정하기 위한 index
1
content
string
LLM 답변 (일부)
is_final_event
boolean
마지막 response 인지 여부
false
마지막 response 인 경우 ( is_final_event: false 인 경우)
이름
타입
설명
예시
usage
object
요청에 사용한 LLM 토큰 준비 중인 parameter 입니다. (현재는 모든 값을 0으로 return 합니다.)
usage.total_tokens
string
총 토큰 수
0
usage.prompt_tokens
string
input 토큰 수
0
usage.completion_tokens
string (ISO8601)
output 토큰 수
0
message
string (ISO8601)
LLM 답변 정보
message.content
boolean
LLM 답변 내용
안녕하세요! 어떻게 도와드릴까요?
message.generated_result_trust_score
array of object
0 ~ 100 점 사이의 LLM 답변 신뢰 점수
0.00
created
string (unix stamp)
LLM에 질문이 인입된 시점
1715837713
task_id
string
LLM에서 task에 부여한 ID
0690af57-ac3e-495e-8a31-a680588be970
chat_engine
string
사용한 LLM 종류 (플랫폼)
openai
contexts
array of object
LLM 답변을 위해 참고한 청크들
contexts.type
string
청크가 존재하는 지식의 타입. document 또는 feedback
feedback
contexts.bucketName
string
청크가 존재하는 지식이 속한 bucket 이름
테스트_feedback
contexts.fileName
string
청크가 존재하는 지식명
gnu-c-manual.pdf
contexts.pageName
string
청크가 존재하는 페이지 만약 여러 페이지에 걸쳐있다면, , 로 구분합니다.
90
contexts.context
string
청크
안녕하세요!\n\n\n안녕하세요! 어떻게 도와드릴까요?
contexts.referenceIdx
number
LLM 답변에 [1] 과 같은 형태로 표시될때 쓰이는 context의 Idx 정보 LLM 답변에서 [referenceIdx + 1] 형태로 표시됩니다.
0
no_relevant_knowledge
boolean
응답에 실패했을때 원인을 파악하기 위한 flag 입니다. 연관 지식이 없어서 응답에 실패한 경우 true, 기타 내부 오류로 응답에 실패한 경우 false 를 return 합니다. 응답에 성공한 경우에도 false 를 리턴합니다. (default)
false
is_final_event
string
마지막 response 인지 여부
true
{ "id": "0690af57-ac3e-495e-8a31-a680588be970", "event_id": 0, "content": "", "is_final_event": false } { "id": "0690af57-ac3e-495e-8a31-a680588be970", "event_id": 1, "content": "안", "is_final_event": false } { "id": "0690af57-ac3e-495e-8a31-a680588be970", "event_id": 2, "content": "녕", "is_final_event": false } { "id": "0690af57-ac3e-495e-8a31-a680588be970", "event_id": 3, "content": "하세요", "is_final_event": false } { "id": "0690af57-ac3e-495e-8a31-a680588be970", "event_id": 4, "content": "!", "is_final_event": false } { "usage": { "total_tokens": 0, "prompt_tokens": 0, "completion_tokens": 0 }, "message": { "content": "안녕하세요! 어떻게 도와드릴까요?", "generated_result_trust_score": "0.00" }, "created": 1715837713, "task_id": "0690af57-ac3e-495e-8a31-a680588be970", "chat_engine": "openai", "relevant_knowledges": [], "contexts": [ { "context": "안녕하세요!\n\n\n안녕하세요! 어떻게 도와드릴까요?", "bucket_name": "테스트", "filename": "테스트_feedback", "page_name": "advice", "type": "feedback" } ], "no_relevant_knowledge": false, "is_final_event": true }
JSON
복사