Skip to Content
Open APIOntologiesTranslate SQL

Translate SQL — 자연어 → Ontology Lake SQL 변환

회사의 온톨로지 메타데이터를 활용해 자연어 질문을 Ontology Lake SQL 쿼리로 변환합니다.

  • Endpoint: POST /open/v1/ontologies/query-translate
  • Tag: Open API
  • 인증: API Key (Authorization: Bearer {API_KEY})

응답 래퍼/에러 포맷은 공통 사항 문서를 참고하세요.


Request

Headers

Header타입필수설명
AuthorizationstringYBearer 토큰 형식의 API Key. Bearer {API_KEY}

Body

{ "question": "지난 30일간 가장 많이 판매된 상품 TOP 10을 알려줘", "ontologyIds": [101, 102], "includeReasoning": false }
필드타입필수기본값설명
questionstringY-자연어 질문
ontologyIdsnumber[]N전체변환에 사용할 온톨로지 ID 화이트리스트. 미지정 시 전체 대상
includeReasoningbooleanNtruefalsereasoning을 생성하지 않아 응답 속도가 빨라집니다 (항상 null)

Response (data)

{ "sparkSql": "SELECT product_id, SUM(quantity) ... ", "reasoning": "사용된 테이블/조건에 대한 설명", "usedOntologies": [ { "id": 101, "name": "orders", "displayName": "주문", "type": "Json", "collectionName": "orders_collection", "fullyQualifiedTableName": "warehouse.public.orders" } ] }
필드타입설명
sparkSqlstring | null변환된 Ontology Lake SQL. 변환 실패 시 null
reasoningstring | null변환 근거/추론 설명. includeReasoning: false면 항상 null
usedOntologies[].idnumber사용된 온톨로지 ID
usedOntologies[].namestring시스템 식별 이름
usedOntologies[].displayNamestring | null표시용 이름
usedOntologies[].typestring온톨로지 타입 (예: Json)
usedOntologies[].collectionNamestring컬렉션/소스 이름
usedOntologies[].fullyQualifiedTableNamestring | nullSQL 실행 대상 테이블 FQN

Example

curl -X POST "https://[your-base-url]/open/v1/ontologies/query-translate" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "question": "지난 30일간 가장 많이 판매된 상품 TOP 10을 알려줘", "ontologyIds": [101, 102], "includeReasoning": false }'
Last updated on