Skip to content

ChatBot-AI FastAPI 명세서 #4

@CutTheWire

Description

@CutTheWire

📌 ChatBot-AI FastAPI 명세서

📢 개요

  • API 이름: ChatBot-AI FastAPI
  • 설명: AI 모델 관리 API
  • 버전: v1.5.0
  • 로고:
    ChatBot-AI 로고

이 API는 다양한 AI 모델을 활용하여 검색 기반 응답 생성 및 캐릭터 기반 대화를 제공하며, MongoDB와 연동하여 대화 기록을 관리합니다.


📍 엔드포인트 목록

🔹 루트 엔드포인트

  • GET /
    • 설명: 루트 엔드포인트
    • 응답: { "message": "Welcome to ChatBot-AI API. Access from IP: [IP 주소]" }

🔹 Office 모델 (정보 제공 모델)

📌 Llama 모델 (Bllossom)

  • POST /office/Llama
    • 설명: Bllossom_8B 모델이 검색 결과를 활용하여 답변을 생성합니다.

    • 요청 본문

      {
        "input_data": "Llama AI 모델의 출시일과 버전들을 각각 알려줘.",
        "google_access": false,
        "db_id": "123e4567-e89b-12d3-a456-426614174000",
        "user_id": "shaa97102"
      }
      필드명 타입 제약조건 설명 예시
      input_data string minLength=1, maxLength=500 사용자 입력 문장 "Llama AI 모델의 출시일과 버전들을 각각 알려줘."
      google_access boolean 기본값: false 검색 기반 액세스 (True: 활성화, False: 제한됨) false 또는 true
      db_id string null 가능 케릭터 DB ID "123e4567-e89b-12d3-a456-426614174000"
      user_id string null 가능, 1-50자 유저 ID "shaa97102"
    • 필수 필드: input_data

    • 응답: 모델이 생성한 텍스트 응답

📌 GPT-4o-mini 모델

  • POST /office/gpt4o_mini
    • 설명: OpenAI의 GPT-4o-mini 모델이 검색 결과를 활용하여 답변을 생성합니다.

    • 요청 본문

      {
        "input_data": "Llama AI 모델의 출시일과 버전들을 각각 알려줘.",
        "google_access": false,
        "db_id": "123e4567-e89b-12d3-a456-426614174000",
        "user_id": "shaa97102"
      }
      필드명 타입 제약조건 설명 예시
      input_data string minLength=1, maxLength=500 사용자 입력 문장 "Llama AI 모델의 출시일과 버전들을 각각 알려줘."
      google_access boolean 기본값: false 검색 기반 액세스 (True: 활성화, False: 제한됨) false 또는 true
      db_id string null 가능 케릭터 DB ID "123e4567-e89b-12d3-a456-426614174000"
      user_id string null 가능, 1-50자 유저 ID "shaa97102"
    • 필수 필드: input_data

    • 응답: 모델이 생성한 텍스트 응답


🔹 Character 모델 (캐릭터 기반 대화 모델)

📌 Llama 모델 (Lumimaid)

  • POST /character/llama
    • 설명: Lumimaid_8B 모델이 캐릭터 설정을 기반으로 응답을 생성합니다.
    • 요청 본문
      {
        "input_data": "*I approach Rachel and talk to her.*",
        "character_name": "Rachel",
        "greeting": "*Clinging to the lectern, there stands Rachel...*",
        "context": "Rachel + Rachel is a devout Catholic girl of about 19 years old...",
        "db_id": "123e4567-e89b-12d3-a456-426614174000",
        "user_id": "shaa97102"
      }
      필드명 타입 제약조건 설명 예시
      input_data string minLength=1, maxLength=500 사용자 입력 문장 "*I approach Rachel and talk to her.*"
      character_name string minLength=1 케릭터 이름 "Rachel"
      greeting string minLength=1 케릭터 인사말 긴 인사말 텍스트
      context string minLength=1 케릭터 설정 값 캐릭터의 배경, 성격 등에 대한 설명 텍스트
      db_id string null 가능 케릭터 DB ID "123e4567-e89b-12d3-a456-426614174000"
      user_id string null 가능, 1-50자 유저 ID "shaa97102"
    • 필수 필드: input_data, character_name, greeting, context
    • 응답: 캐릭터 역할의 모델이 생성한 텍스트 응답

📌 GPT-4o-mini 모델 (캐릭터)

  • POST /character/gpt4o_mini
    • 설명: OpenAI의 GPT-4o-mini 모델이 캐릭터 설정을 기반으로 응답을 생성합니다.
    • 요청 본문
      {
        "input_data": "*I approach Rachel and talk to her.*",
        "character_name": "Rachel",
        "greeting": "*Clinging to the lectern, there stands Rachel...*",
        "context": "Rachel + Rachel is a devout Catholic girl of about 19 years old...",
        "db_id": "123e4567-e89b-12d3-a456-426614174000",
        "user_id": "shaa97102"
      }
      필드명 타입 제약조건 설명 예시
      input_data string minLength=1, maxLength=500 사용자 입력 문장 "*I approach Rachel and talk to her.*"
      character_name string minLength=1 케릭터 이름 "Rachel"
      greeting string minLength=1 케릭터 인사말 긴 인사말 텍스트
      context string minLength=1 케릭터 설정 값 캐릭터의 배경, 성격 등에 대한 설명 텍스트
      db_id string null 가능 케릭터 DB ID "123e4567-e89b-12d3-a456-426614174000"
      user_id string null 가능, 1-50자 유저 ID "shaa97102"
    • 필수 필드: input_data, character_name, greeting, context
    • 응답: 캐릭터 역할의 모델이 생성한 텍스트 응답

🛠 응답 구조 및 오류 처리

일반 응답

  • 정상 응답: 모델이 생성한 텍스트 응답
  • 오류 응답: HTTP 상태 코드와 함께 오류 상세 정보 제공

주요 오류 코드

  • 400: Bad Request - 잘못된 요청 형식
  • 401: Unauthorized - 인증 실패
  • 403: Forbidden - 접근 권한 없음
  • 405: Method Not Allowed - 허용되지 않은 HTTP 메소드
  • 422: Unprocessable Entity - 요청 데이터 유효성 검사 실패
  • 500: Internal Server Error - 서버 내부 오류

ValidationError

  • 타입: object

  • 제목: ValidationError

  • 필수 필드: loc, msg, type

  • Properties:

    필드명 타입 설명
    loc array (string 또는 integer) 에러 위치를 나타내며, 문자열 또는 정수값으로 구성됨
    msg string 에러 메시지
    type string 에러 유형

📑 특이사항

  • IP 제한: 특정 엔드포인트는 허용된 IP 주소 또는 내부 네트워크에서만 접근 가능합니다.
  • 봇 차단: 봇의 접근은 자동으로 차단됩니다.
  • MongoDB 통합: 사용자 대화 기록은 MongoDB에 저장되어 연속적인 대화를 지원합니다.
  • 검색 기능: google_access 매개변수를 통해 DuckDuckGo 검색 결과를 응답에 통합할 수 있습니다.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions