Registry / ai-ml / google-cloud-dialogflow

google-cloud-dialogflow

JSON →
library2.48.0pypypi✓ verified 83d ago

Google Cloud Dialogflow API client library (v2.48.0) for building conversational interfaces (chatbots, IVR). Released monthly. Requires Python >=3.10.

pip install google-cloud-dialogflow
INSTALL
IMPORT
SIG · GOOGLE-CLOUD-DIALO
G
google-cloud-dialogflow
ai-mlpythonv2.48.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SessionsClient
from google.cloud.dialogflow_v2 import SessionsClient
from google.cloud import dialogflow_v2
Direct import of client classes from submodule avoids ambiguity.
QueryResult
from google.cloud.dialogflow_v2.types import QueryResult
IntentsClient
from google.cloud.dialogflow_v2 import IntentsClient

Detect intent from a text query. Ensure GOOGLE_CLOUD_PROJECT env var is set and credentials configured (gcloud auth application-default-login).

import os from google.cloud.dialogflow_v2 import SessionsClient project_id = os.environ.get('GOOGLE_CLOUD_PROJECT', 'my-project') session_id = 'test-session' text = 'Hello' language_code = 'en' client = SessionsClient() session = client.session_path(project_id, session_id) text_input = {'text': {'text': text, 'language_code': language_code}} query_input = {'text': text_input['text']} response = client.detect_intent(request={'session': session, 'query_input': query_input}) print('Query:', response.query_result.query_text) print('Response:', response.query_result.fulfillment_text)
Debug
Known issues
breakinggoogle-cloud-dialogflow v2 uses the v2 API; v1 is deprecated and will be removed. Migrate from v1 imports (google.cloud.dialogflow) to v2 (google.cloud.dialogflow_v2).
fix
Update imports to from google.cloud.dialogflow_v2 import ... and update method signatures.
affects: <=1.x
gotcharegion and language_code parameters in detect_intent must match globally available agent; otherwise request fails with 400 INVALID_ARGUMENT.
fix
Ensure agent is deployed in the same region as the client endpoint (default: global).
affects: all
deprecatedUsing google.cloud.dialogflow (without version) is deprecated; always specify the version (v2) in imports.
fix
Import from google.cloud.dialogflow_v2 instead.
affects: >=2.0
Errors
Common errors & fixes
google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes.
Default application credentials (ADC) do not include Dialogflow API scope.
fix
Set environment variable GOOGLE_APPLICATION_CREDENTIALS to a service account JSON file with 'Dialogflow API Client' role.
google.api_core.exceptions.InvalidArgument: 400 Session path not found.
The session_id does not exist; sessions are created on-the-fly but must be alphanumeric.
fix
Use a simple alphanumeric session ID (e.g., 'test-session-1') without special characters.
TypeError: __init__() got an unexpected keyword argument 'request'
Using old-style positional arguments instead of dict-based request parameter.
fix
Pass request as a keyword argument: client.detect_intent(request={'session': ..., 'query_input': ...})
Upgrade
Version history
2.48.0latest on PyPI · released Jun 3, 2026
Audit
Dependencies
google-api-corerequiredCore Google API infrastructure
grpciorequiredgRPC transport for API calls
google-cloud-storageoptionalStoring audio files for streaming recognition
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
google-cloud-dialogflow — pip install google-cloud-dialogflow · libregistry