최종 사용자가 이전 대화 차례에서 dogs를 선택한 경우 최종 사용자에게 개 사진이 표시됩니다.
최종 사용자가 이전 대화 차례에서 cats를 선택한 경우 최종 사용자에게 고양이 사진이 표시됩니다.
활성 컨텍스트가 없는 경우:
pet-init 인텐트가 일치합니다.
최종 사용자에게 반려동물 유형을 선택하라는 메시지가 표시됩니다.
수명
각 활성 컨텍스트에는 컨텍스트가 활성 상태인 동안에 대화 차례 수를 정의하는 수명이 있습니다.
기본 수명은 일반 인텐트의 경우 대화 차례 5회이고 후속 조치 인텐트의 경우 대화 차례 2회입니다.
모든 컨텍스트의 기본 수명을 재정의할 수 있습니다.
또한 모든 컨텍스트가 활성화된 후 20분이 지나면 만료됩니다.
인텐트가 이미 활성 상태인 출력 컨텍스트와 일치하면 수명 및 만료 타이머가 재설정됩니다.
예를 들어 반려동물 정보 에이전트의 다음 인텐트 설명을 살펴보세요.
인텐트 이름
학습 문구
매개변수
입력 컨텍스트
출력 컨텍스트
응답
pet-init
'어떻게 생겼나요?' '어떤 소리를 내나요?' '얼마나 크나요?'
-
-
-
'어떤 종류의 반려동물을 좋아하세요?'
pet-select
'개', '고양이'를 좋아합니다.'
pet
-
pet-chosen(수명 = 2)
'$pet?에 대해 무엇을 알고 싶으세요?'
pet-show
'어떻게 생겼나요?'
-
pet-chosen
-
'#pet-chosen.pet 사진입니다. 더 알고 싶은 것이 있으세요?'
pet-audio
'어떤 소리를 내나요?'
-
pet-chosen
-
'#pet-chosen.pet의 소리입니다. 더 알고 싶은 것이 있으세요?'
pet-size
'얼마나 크나요?'
-
pet-chosen
-
'#pet-chosen.pet의 크기 표입니다. 더 알고 싶은 것이 있으세요?'
다음 표에는 pet-chosen 컨텍스트의 수명을 보여주는 이 애완동물 정보 에이전트의 대화상자 예시가 나와 있습니다.
차례
대화상자
설명
1
에이전트: 어떤 종류의 반려동물을 좋아하세요?
pet-init 인텐트가 일치합니다.
2
사용자: 나는 고양이를 좋아해요. 에이전트: 고양이에 대해 무엇을 알고 싶으세요?
pet-select 인텐트가 일치합니다. pet-chosen 출력 컨텍스트가 활성 컨텍스트가 됩니다.
3
사용자: 어떻게 생겼나요? 에이전트: 고양이 사진입니다. 더 알고 싶은 것이 있으세요?
pet-show 인텐트에는 pet-chosen 입력 컨텍스트가 있으므로 일치합니다. pet-chosen 컨텍스트는 차례 1회 동안 활성화되었습니다.
4
사용자: 어떤 소리를 내나요? 에이전트: 고양이 소리입니다. 더 알고 싶은 것이 있으세요?
pet-audio 인텐트에는 pet-chosen 입력 컨텍스트가 있으므로 일치합니다. pet-chosen 컨텍스트는 차례 2회 동안 활성화되었습니다.
5
사용자: 얼마나 큰가요? 에이전트: 어떤 종류의 반려동물을 좋아하세요?
pet-chosen 컨텍스트는 더 이상 활성 상태가 아니므로 pet-init 인텐트가 다시 일치합니다.
입력 컨텍스트
컨텍스트가 활성화되면 Dialogflow에서는 현재 활성 컨텍스트에 해당하는 입력 컨텍스트로 구성된 인텐트가 일치할 가능성이 더 높습니다.
자세한 인텐트 일치 규칙은 다음과 같습니다.
일치하려면 인텐트의 입력 컨텍스트 목록이 현재 컨텍스트 목록의 하위 집합이어야 합니다.
이는 입력 컨텍스트가 없는 인텐트의 경우에도 마찬가지입니다.
1번 규칙을 충족하는 인텐트의 경우 현재 활성 컨텍스트 목록과 가장 가깝게 일치하는 입력 컨텍스트 목록이 있는 인텐트가 일치할 가능성이 더 높습니다.
예를 들면 다음과 같습니다.
입력 컨텍스트가 없는 인텐트는 언제든지 일치할 수 있습니다.
활성 컨텍스트가 없으면 입력 컨텍스트가 없는 인텐트만 일치할 수 있습니다.
컨텍스트 'A'와 'B'가 활성 상태이면 'A'와 'C' 입력 컨텍스트가 있는 인텐트는 일치할 수 없습니다.
컨텍스트 'A, 'B', 'C'가 활성 상태이면 'A'와 'B' 입력 컨텍스트가 있는 인텐트는 일치할 수 있습니다.
컨텍스트 'A'와 'B'가 활성 상태이면 'A'와 'B' 입력 컨텍스트가 있는 인텐트는 입력 컨텍스트가 없는 인텐트나 입력 컨텍스트 'A'만 있는 인텐트보다 일치할 가능성이 더 높습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eOutput contexts become active when their associated intent is matched, influencing the flow of the conversation.\u003c/p\u003e\n"],["\u003cp\u003eInput contexts control intent matching by making Dialogflow more likely to match intents with input contexts that are a subset of currently active contexts.\u003c/p\u003e\n"],["\u003cp\u003eContexts allow for controlling the order of intent matching and creating context-specific intents that use identical training phrases.\u003c/p\u003e\n"],["\u003cp\u003eActive contexts have a lifespan that determines how many conversational turns they remain active, with a default of five turns, and they expire after 20 minutes.\u003c/p\u003e\n"],["\u003cp\u003eWhen an intent with an output context is matched, its parameter values can be stored temporarily and accessed in future turns as long as the context remains active.\u003c/p\u003e\n"]]],[],null,["# Input and output contexts are applied to\n[intents](/dialogflow/docs/intents-overview).\nThey work together to control conversation flow:\n\n- [**Output contexts**](#output_contexts) control *active* contexts. When an intent is matched, any configured output contexts for that intent become active.\n- [**Input contexts**](#input_contexts) control intent matching. While contexts are active, Dialogflow is more likely to match intents that are configured with input contexts that are a subset of currently active contexts.\n\nWith contexts, you can:\n\n- Control the order of intent matching.\n- Create context-specific intents with the same training phrases.\n\nFor example, consider the following intents:\n\nWhen the end-user says `I like dogs`:\n\n- The `pet-select-dogs` intent is matched.\n- The output context is `dogs`, so it becomes the active context.\n\nWhen the end-user says `I like cats`:\n\n- The `pet-select-cats` intent is matched.\n- The output context is `cats`, so it becomes the active context.\n\nWhen the end-user says `What do they look like?`:\n\n- If `dogs` is the active context:\n - The `dog-show` intent is matched.\n - The end-user is shown a dog picture.\n- If `cats` is the active context:\n - The `cat-show` intent is matched.\n - The end-user is shown a cat picture.\n- If there is no active context:\n - The `pet-init` intent is matched.\n - The end-user is asked what kind of pet they like.\n\nOutput contexts\n---------------\n\nMultiple output contexts can be applied to an intent.\nWhen an intent is matched,\nany output contexts applied to the intent become active.\n\n### Parameter references for active contexts\n\nWhen an intent with output context is matched,\nits collected parameter values can serve as temporary storage with\n[parameter references for active contexts](/dialogflow/docs/intents-actions-parameters#context).\nThese values can be accessed during future intent matching,\nfor as long as the context remains active.\n\nFor example, consider the following variation of the pet example above:\n\nWhen the end-user says `I like dogs` or `I like cats`:\n\n- The `pet-select` intent is matched.\n- The `pet` [parameter](/dialogflow/docs/intents-actions-parameters) is set to the chosen pet type.\n- The output context is `pet-chosen`, so it becomes the active context.\n\nWhen the end-user says `What do they look like?`:\n\n- If `pet-chosen` is the active context:\n - The `pet-show` intent is matched.\n - If the end-user selected `dogs` in the prior conversational turn, the end-user is shown a dog picture.\n - If the end-user selected `cats` in the prior conversational turn, the end-user is shown a cat picture.\n- If there is no active context:\n - The `pet-init` intent is matched.\n - The end-user is asked to select a pet type.\n\n### Lifespan\n\nEach active context has a lifespan\nthat defines the number of conversational turns\nfor which the context remains active.\nThe default lifespan is five conversational turns for normal intents\nand two conversational turns for\n[follow-up intents](/dialogflow/docs/contexts-follow-up-intents).\nYou can override the default lifespan for any contexts.\nIn addition, all contexts expire after 20 minutes of becoming active.\nWhen an intent is matched with an output context that is already active,\nthe lifespan and expiration timer are reset.\n\nFor example, consider the following intent descriptions for a pet information agent:\n\nThe following table shows an example dialogue for this pet information agent,\nwhich illustrates the lifespan of the `pet-chosen`context:\n\nInput contexts\n--------------\n\nWhile contexts are active,\nDialogflow is more likely to match intents that are configured\nwith input contexts that correspond to the currently active contexts.\nThe detailed intent matching rules are as follows:\n\n1. An intent's input context list must be a subset of the currently active context list in order to be matched. This also applies to intents with no input contexts.\n2. For intents that satisfy rule #1, those with an input context list that most closely match the currently active context list are more likely to be matched.\n\nFor example:\n\n- Intents with no input contexts can be matched at any time.\n- When no contexts are active, only intents with no input contexts can be matched.\n- If contexts \"A\" and \"B\" are active, an intent with \"A\" and \"C\" input contexts cannot be matched.\n- If contexts \"A\", \"B\", and \"C\" are active, an intent with \"A\" and \"B\" input contexts can be matched.\n- If contexts \"A\" and \"B\" are active, an intent with \"A\" and \"B\" input contexts is more likely to be matched than an intent with no input context or an intent with just \"A\" for an input context."]]