소스별로 구성된 명시적인 소스 설정하다 에서 대화 컨텍스트를 어셈블하며, 각 소스는 자체 검색 모드 (텍스트, 시맨틱, 하이브리드), 메타데이터 필터하다 및 후보 수를 선언합니다. 결과는 여러 소스에서 병합 및 중복 제거되며, 선택적으로 순위가 재지정된 다음 build_context와 같이 형식이 지정되고 예산이 책정됩니다. 프로젝트 범위는 경로 ID 경로 매개 변수에 의해 전달되며 조직은 해당 프로젝트 에서 파생됩니다. 비어 있지 않은 쿼리, 메모리를 어셈블할 메모리의 user_id, 비어 있지 않은 소스 목록을 제공합니다.
body
필수 사항
소스별 컨텍스트 빌드 요청
-
MaxTokens는 총 컨텍스트 구성 예산(가져오기 비용 아님)으로, build_context와 같이 해석됩니다: 서버 500-토큰 서식 지정 예비비를 뺀 다음, 꼭 맞는 전체 메모리 청크를 탐욕스럽게 선택합니다.
최소값은
1입니다. -
재지정은 병합된 결과를 관련성에 따라 재정렬합니다(사용 가능한 경우 재지정).
-
소스는 명시적인 소스별로 구성된 검색 설정하다 입니다. 메모리 서버 카운트 바운드(1..MAX_CONTEXT2_SOURCES), 각 소스의 top_k 바운드 및 중복 소스 금지 규칙을 적용합니다.
POST /api/v1/projects/{id}/memory/reterieval/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
}