본문 바로가기
WIKI 기술 지식 베이스

Get Message API

원문 보기 위키 갱신

출처: 문서

본문

메시지 API 조회

2.12에 도입됨 {: .label .label-purple }

이 API를 사용하여 대화형 검색의 메시지 정보를 검색해요.

메시지 정보를 검색하려면 다음을 사용할 수 있어요:

Security 플러그인이 활성화되면 모든 메모리는 private 보안 모드로 존재해요. 메모리를 생성한 사용자만 해당 메모리와 그 메시지에 상호작용할 수 있어요. {: .important}

ID로 메시지 조회

message_id를 사용하여 메시지 정보를 검색할 수 있어요.

엔드포인트

GET /_plugins/_ml/memory/message/{message_id}

경로 매개변수

다음 표는 사용 가능한 경로 매개변수를 보여줘요.

매개변수 데이터 타입 설명
message_id String 검색할 메시지의 ID예요.

요청 예시

GET /_plugins/_ml/memory/message/0m8ya40BfUsSoeNTj-pU

{% include copy-curl.html %}

응답 예시

{
  "memory_id": "gW8Aa40BfUsSoeNTvOKI",
  "message_id": "0m8ya40BfUsSoeNTj-pU",
  "create_time": "2024-02-02T19:01:32.113621539Z",
  "updated_time": "2024-02-02T19:01:32.113621539Z",
  "input": null,
  "prompt_template": null,
  "response": "Hello, this is OpenAI. Here is the answer to your question.",
  "origin": null,
  "additional_info": {
    "suggestion": "api.openai.com"
  }
}

응답 필드에 대한 자세한 내용은 메시지 생성 요청 필드를 참조해요.

메모리 내 모든 메시지 조회

이 명령을 사용하여 특정 메모리의 메시지 목록을 가져와요.

엔드포인트

GET /_plugins/_ml/memory/{memory_id}/messages

경로 매개변수

다음 표는 사용 가능한 경로 매개변수를 보여줘요.

매개변수 데이터 타입 설명
memory_id String 메시지를 검색할 메모리의 ID예요.

응답 본문 필드

다음 표는 사용 가능한 응답 필드를 보여줘요.

필드 데이터 타입 설명
memory_id String 메모리 ID예요.
message_id String 메시지 ID예요.
create_time String 메시지가 생성된 시간이에요.
updated_time String 메시지가 마지막으로 업데이트된 시간이에요.
input String 메시지의 질문(사람 입력)이에요.
prompt_template String 메시지에 사용된 프롬프트 템플릿이에요.
response String 질문에 대한 답변(생성형 AI 출력)이에요.
origin String 응답을 생성한 AI 또는 다른 시스템의 이름이에요.
additional_info Object origin으로 전송된 기타 정보예요.
parent_message_id String 상위 메시지의 ID(추적 메시지의 경우)예요.
trace_number Integer 추적 번호(추적 메시지의 경우)예요.

요청 예시

GET /_plugins/_ml/memory/gW8Aa40BfUsSoeNTvOKI/messages

{% include copy-curl.html %}

POST /_plugins/_ml/message/_search
{
  "query": {
    "match_all": {}
  },
  "size": 1000
}

{% include copy-curl.html %}

응답 예시

{
  "messages": [
    {
      "memory_id": "gW8Aa40BfUsSoeNTvOKI",
      "message_id": "BW8ha40BfUsSoeNT8-i3",
      "create_time": "2024-02-02T18:43:23.566994302Z",
      "updated_time": "2024-02-02T18:43:23.566994302Z",
      "input": "How do I make an interaction?",
      "prompt_template": "Hello OpenAI, can you answer this question?",
      "response": "Hello, this is OpenAI. Here is the answer to your question.",
      "origin": "MyFirstOpenAIWrapper",
      "additional_info": {
        "suggestion": "api.openai.com"
      }
    },
    {
      "memory_id": "gW8Aa40BfUsSoeNTvOKI",
      "message_id": "0m8ya40BfUsSoeNTj-pU",
      "create_time": "2024-02-02T19:01:32.113621539Z",
      "updated_time": "2024-02-02T19:01:32.113621539Z",
      "input": null,
      "prompt_template": null,
      "response": "Hello, this is OpenAI. Here is the answer to your question.",
      "origin": null,
      "additional_info": {
        "suggestion": "api.openai.com"
      }
    }
  ]
}

더 알아보기 (Learn more)