명시적이고 소스 별로 구성된 소스 세트에서 대화 컨텍스트를 구성합니다. 각 소스는 검색 모드(텍스트, 의미, 하이브리드), 메타데이터 필터 및 후보 개수를 선언합니다. 결과는 소스별로 통합되고 중복이 제거되며, 필요에 따라 순위를 재정렬할 수도 있으며, 그 다음 build_context와 같이 형식화되고 예산이 할당됩니다. 프로젝트 범위는 경로 ID 매개 변수에 의해 전달되며 조직은 해당 프로젝트에서 파생됩니다. 비어 있는 쿼리, 메모리를 조립할 user_id, 그리고 비어 있는 소스 목록을 제공하세요.
body
필수 사항
소스별 컨텍스트 빌드 요청
-
MaxTokens는 총 컨텍스트 구성 예산(가져오기 비용이 아닙니다)이며, build_context와 같이 해석됩니다. 서버는 500토큰 포맷 예약을 공제하고 맞는 전체 메모리 청크를 탐욕적으로 선택합니다.
최소값은
1입니다. -
Rerank는 사용 가능한 경우 관련성 Rerank를 기준으로 병합된 결과를 재정렬합니다.
-
소스는 검색할 수 있는 명시적인 소스별 구성된 세트입니다. 메모리 서버는 개수 범위(1..MAX_CONTEXT2_SOURCES)와 각 소스의 top_k 범위 및 중복 소스 금지 규칙을 시행합니다.
게시 /API/v1/프로젝트/{id}/memory/retrieval/context-from-sources
curl \
--request POST 'https://agentengine.mongodb.com/api/v1/projects/{id}/memory/retrieval/context-from-sources' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"format_style": "string",
"include_memories": true,
"max_tokens": 42,
"model_type": "string",
"query": "string",
"query_embedding": [
42.0
],
"rerank": true,
"session_id": "string",
"sources": [
{
"metadata_filter": {},
"mode": "string",
"source": "string",
"top_k": 42
}
],
"user_id": "string",
"visibility": "string"
}'
요청 예시
{
"format_style": "string",
"include_memories": true,
"max_tokens": 42,
"model_type": "string",
"query": "string",
"query_embedding": [
42.0
],
"rerank": true,
"session_id": "string",
"sources": [
{
"metadata_filter": {},
"mode": "string",
"source": "string",
"top_k": 42
}
],
"user_id": "string",
"visibility": "string"
}
응답 예시(406)
작업을 사용할 수 없습니다.
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
"error": 406,
"errorCode": "UNACCEPTABLE_MEDIA_TYPE",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
"error": 406,
"errorCode": "UNSUPPORTED_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
응답 예시(406)
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
응답 예시(200)
{}
응답 예시(200)
{}
응답 예시(400)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(400)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(401)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(401)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(403)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(403)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(500)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(500)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(502)
{
"code": "string",
"error": "string",
"success": true
}
응답 예시(502)
{
"code": "string",
"error": "string",
"success": true
}