Initial commit

This commit is contained in:
kyy committed 2025-07-18 17:32:56 +09:00
commit e575ec8c80
11 files changed
+416

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"openapi":"3.1.0","info":{"title":"LLM GATEWAY","description":"LLM 모델이 업로드된 문서를 분석하여 구조화된 JSON으로 변환하는 API 서비스입니다.","version":"0.1.0"},"paths":{"/metrics":{"get":{"summary":"Metrics","description":"Endpoint that serves Prometheus metrics.","operationId":"metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/schema_file_guide":{"get":{"tags":["Guide Book"],"summary":"schema 파일 작성 가이드북 HTML 보기","description":"📄 본 가이드북은 <strong>/general</strong> 및 <strong>/extract/structured</strong> 엔드포인트에 첨부되는 <strong>schema_file</strong> 작성법을 설명합니다.<br><br>가이드북은 <a href='/schema_file_guide' target='_blank'>여기</a>에서 확인하세요.","operationId":"schema_guide_schema_file_guide_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/general_guide":{"get":{"tags":["Guide Book"],"summary":"/general 가이드북 HTML 보기","description":"가이드북을 <a href='/general_guide' target='_blank'>여기</a>에서 확인하세요.","operationId":"general_guide_general_guide_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/extract_guide":{"get":{"tags":["Guide Book"],"summary":"/extract 가이드북 HTML 보기","description":"가이드북을 <a href='/extract_guide' target='_blank'>여기</a>에서 확인하세요.","operationId":"extract_guide_extract_guide_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/info":{"get":{"tags":["Model Management"],"summary":"'/extract', '/general' 에서 사용 가능한 모델 목록 확인","description":"✅ 'inner(내부용)' 와 'outer(외부용)' 모델의 사용 가능한 목록을 확인합니다.<br>\n ✅ 'Try it out' → 'Execute' 순서로 클릭합니다.<br>","operationId":"get_model_info_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/default_prompt":{"get":{"tags":["Model Management"],"summary":"기본 프롬프트 파일 다운로드","operationId":"download_default_prompt_default_prompt_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/structured_prompt":{"get":{"tags":["Model Management"],"summary":"구조화 프롬프트 파일 다운로드","operationId":"download_structured_prompt_structured_prompt_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/structured_schema":{"get":{"tags":["Model Management"],"summary":"구조화 포맷 정의 파일 다운로드","operationId":"download_structured_schema_structured_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/general/inner":{"post":{"tags":["General"],"summary":"내부 LLM 기반 범용 추론 요청 (비동기)","description":"### **요약**\n내부망에 배포된 LLM(Ollama 기반)을 사용하여 문서 기반의 범용 추론을 비동기적으로 요청합니다. 이 엔드포인트는 파일(PDF, 이미지 등)에서 텍스트를 추출하고, 사용자가 제공한 프롬프트를 적용하여 결과를 생성합니다.\n\n### **작동 방식**\n1. **요청 접수**: `input_file`, `prompt_file` 등을 받아 고유한 `request_id`를 생성하고 즉시 반환합니다.\n2. **백그라운드 처리**:\n - `input_file`이 문서나 이미지일 경우, **OCR API**를 호출하여 텍스트를 추출합니다.\n - 추출된 텍스트와 `prompt_file`의 내용을 조합하여 최종 프롬프트를 구성합니다.\n - 내부 LLM(Ollama)에 추론을 요청합니다.\n - `schema_file`이 제공되면, LLM이 스키마에 맞는 JSON을 생성하도록 요청합니다.\n3. **상태 및 결과 확인**: 반환된 `request_id`를 사용하여 `GET /general/progress/{request_id}` 엔드포인트에서 작업 진행 상태와 최종 결과를 조회할 수 있습니다.\n\n### **입력 (multipart/form-data)**\n- `input_file` (**필수**): 추론의 기반이 될 문서 파일.\n - 지원 형식: `.pdf`, `.docx`, `.jpg`, `.png`, `.jpeg` 등.\n - 내부적으로 OCR을 통해 텍스트가 자동 추출됩니다.\n- `prompt_file` (**필수**): LLM에 전달할 명령어(프롬프트)가 포함된 `.txt` 파일.\n- `schema_file` (선택): 결과물의 구조를 정의하는 `.json` 스키마 파일. 제공 시, 출력은 이 스키마를 따르는 JSON 형식으로 강제됩니다.\n- `model` (선택): 사용할 내부 LLM 모델 이름. (기본값: `gemma3:27b`)\n\n### **출력 (application/json)**\n- **초기 응답**:\n ```json\n {\n \"message\": \"작업이 백그라운드에서 실행 Line truncated
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB