Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
I contesti di Dialogflow sono simili al contesto del linguaggio naturale.
Se una persona ti dice "sono arancioni",
hai bisogno del contesto per capire a cosa si riferisce "sono".
Analogamente, affinché Dialogflow possa gestire un'espressione dell'utente finale come questa, deve essere fornito il contesto per poter associare correttamente un intent.
Con i contesti,
puoi controllare il flusso di una conversazione.
Puoi configurare i contesti per un'intenzione impostando
contesti di input e output,
identificati da nomi di stringa.
Quando viene trovata una corrispondenza per un'intenzione, tutti i contesti di output configurati per quell'intenzione diventano attivi.
Quando sono attivi tutti i contesti, Dialogflow ha maggiori probabilità di trovare una corrispondenza per gli intent configurati con contesti di input corrispondenti ai contesti attualmente attivi.
Il seguente diagramma mostra un esempio che utilizza il contesto per un agente bancario.
L'utente finale chiede informazioni sul proprio conto corrente.
Dialogflow associa questa espressione dell'utente finale all'intenzione CheckingInfo.
Questo intento ha un contesto di output checking, quindi il contesto diventa attivo.
L'agente chiede all'utente finale il tipo di informazioni che vuole sul suo conto corrente.
L'utente finale risponde con "il mio saldo".
Dialogflow associa questa espressione dell'utente finale all'intenzione CheckingBalance.
Questo intento ha un contesto di input checking,
che deve essere attivo per corrispondere a questo intento.
Può esistere anche un'intenzione SavingsBalance simile per abbinare la stessa espressione dell'utente finale quando è attivo un contesto savings.
Dopo che il sistema ha eseguito le query necessarie al database,
l'agente risponde con il saldo del conto corrente.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eDialogflow's contexts are used to understand user expressions by providing necessary conversational context, similar to how humans understand natural language.\u003c/p\u003e\n"],["\u003cp\u003eContexts control conversation flow by setting input and output contexts for intents, identified by string names.\u003c/p\u003e\n"],["\u003cp\u003eWhen an intent is matched, its output contexts become active, influencing which intents are more likely to be matched next.\u003c/p\u003e\n"],["\u003cp\u003eDialogflow matches intents with specific input contexts only when those contexts are currently active, allowing for tailored responses.\u003c/p\u003e\n"],["\u003cp\u003eThe banking agent example shows how the "checking" output context from the \u003ccode\u003eCheckingInfo\u003c/code\u003e intent enables the \u003ccode\u003eCheckingBalance\u003c/code\u003e intent to be matched later when a user asks for their balance.\u003c/p\u003e\n"]]],[],null,["# Contexts\n\nDialogflow\n\n*contexts*\n\nare similar to natural language context.\nIf a person says to you \"they are orange\",\nyou need context in order to understand what \"they\" is referring to.\nSimilarly, for Dialogflow to handle an end-user expression like that,\nit needs to be provided with context in order to correctly match an intent.\n\n\nUsing contexts,\nyou can control the flow of a conversation.\nYou can configure contexts for an intent by setting\n[input and output contexts](/dialogflow/docs/contexts-input-output),\nwhich are identified by string names.\nWhen an intent is matched,\nany configured *output contexts* for that intent become active.\nWhile any contexts are active,\nDialogflow is more likely to match intents\nthat are configured with *input contexts* that correspond to\nthe currently active contexts.\n\n\nThe following diagram shows an example that uses context for a banking agent.\n\n1. The end-user asks for information about their checking account.\n2. Dialogflow matches this end-user expression to the `CheckingInfo` intent. This intent has a `checking` output context, so that context becomes active.\n3. The agent asks the end-user for the type of information they want about their checking account.\n4. The end-user responds with \"my balance\".\n5. Dialogflow matches this end-user expression to the `CheckingBalance` intent. This intent has a `checking` input context, which needs to be active to match this intent. A similar `SavingsBalance` intent may also exist for matching the same end-user expression when a `savings` context is active.\n6. After your system performs the necessary database queries, the agent responds with the checking account balance."]]