메모리에서 대화 컨텍스트를 어셈블합니다(기본값 소스: 일시적, 시맨틱, 최근 차례의 경우 enabled_sources에 stm 포함). 프로젝트 범위는 경로 ID 경로 매개 변수에 의해 전달되며 조직은 해당 프로젝트 에서 파생됩니다. 비어 있지 않은 쿼리 (일반적으로 최신 사용자 메시지)와 메모리를 어셈블할 user_id를 제공합니다.
body
필수 사항
컨텍스트 빌드 요청
-
EnabledSources는 메모리 소스(stm, 일시적, 의미적, 분류적, 절차적)를 선택합니다. 생략하면 기본값은 일시적, 시맨틱입니다.
-
MaxTokens는 총 컨텍스트 구성 예산(가져오기 비용 아님)입니다. 검색 및 순위 지정 후 메모리 서버 500-토큰 포맷 예비비를 뺀 다음, 꼭 맞는 전체 메모리 청크를 탐욕적으로 선택합니다. 500 이하의 양수 값은 메모리를 위한 예산을 남기지 않습니다. 500를 초과하는 값은 청크 맞지 않을 때 빈 컨텍스트를 생성할 수 있습니다.
최소값은
1입니다. -
추가 속성이 허용됩니다.
-
최소값은
1, 최대값은200입니다.
POST /api/v1/projects/{id}/memory/context
curl \
--request POST 'https://agentengine.mongodb.com/api/v1/projects/{id}/memory/context' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"enabled_sources": [
"string"
],
"format_style": "string",
"include_memories": true,
"max_tokens": 42,
"metadata_filter": {},
"model_type": "string",
"query": "string",
"query_embedding": [
42.0
],
"session_id": "string",
"similarity_threshold": 42.0,
"top_k": 42,
"user_id": "string",
"visibility": "string"
}'
요청 예시
{
"enabled_sources": [
"string"
],
"format_style": "string",
"include_memories": true,
"max_tokens": 42,
"metadata_filter": {},
"model_type": "string",
"query": "string",
"query_embedding": [
42.0
],
"session_id": "string",
"similarity_threshold": 42.0,
"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
}