I'm trying to create Google DialogFlow CX intent using python google-cloud-dialogflow-cxl library. Here is modified snippet code that took from the official documentation to create an intent. However, the did not work as expected. Once i called sample_create_intent() method it gives me an error says "<coroutine object sample_create_intent at 0x7fde18379040>" and the intent is not created. So, can anyone please help me to fix this code.
Thank You
import google.auth
from google.cloud import dialogflowcx_v3 as dialogflow
project_id = '{project_id}'
location_id = 'us-central1'
agent_id = 'agent_id
key_file = "/content/sample_data/service_account_key.json"
# Load credentials from the JSON key file
cred, project = google.auth.load_credentials_from_file(key_file)
async def sample_create_intent():
# Create a client
client = dialogflow.IntentsAsyncClient(credentials=cred)
# Initialize request argument(s)
intent = dialogflow.Intent()
intent.display_name = "Test"
request = dialogflow.CreateIntentRequest(
parent="projects/{my_project_id}/locations/us-central1/agents/{my_agen_id}/",
intent=intent,
)
# Make the request
response = await client.create_intent(request=request)
# Handle the response
print(response)
sample_create_intent()