コード例 #1
0
async def sample_create_document():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    document = dialogflow_v2.Document()
    document.content_uri = "content_uri_value"
    document.display_name = "display_name_value"
    document.mime_type = "mime_type_value"
    document.knowledge_types = "AGENT_FACING_SMART_REPLY"

    request = dialogflow_v2.CreateDocumentRequest(
        parent="parent_value",
        document=document,
    )

    # Make the request
    operation = client.create_document(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
async def sample_import_documents():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    gcs_source = dialogflow_v2.GcsSources()
    gcs_source.uris = ['uris_value_1', 'uris_value_2']

    document_template = dialogflow_v2.ImportDocumentTemplate()
    document_template.mime_type = "mime_type_value"
    document_template.knowledge_types = "AGENT_FACING_SMART_REPLY"

    request = dialogflow_v2.ImportDocumentsRequest(
        gcs_source=gcs_source,
        parent="parent_value",
        document_template=document_template,
    )

    # Make the request
    operation = client.import_documents(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
async def sample_get_document():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    request = dialogflow_v2.GetDocumentRequest(name="name_value", )

    # Make the request
    response = await client.get_document(request=request)

    # Handle the response
    print(response)
コード例 #4
0
async def sample_list_documents():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    request = dialogflow_v2.ListDocumentsRequest(parent="parent_value", )

    # Make the request
    page_result = client.list_documents(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
コード例 #5
0
async def sample_delete_document():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    request = dialogflow_v2.DeleteDocumentRequest(name="name_value", )

    # Make the request
    operation = client.delete_document(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
async def sample_update_document():
    # Create a client
    client = dialogflow_v2.DocumentsAsyncClient()

    # Initialize request argument(s)
    document = dialogflow_v2.Document()
    document.content_uri = "content_uri_value"
    document.display_name = "display_name_value"
    document.mime_type = "mime_type_value"
    document.knowledge_types = "ARTICLE_SUGGESTION"

    request = dialogflow_v2.UpdateDocumentRequest(document=document, )

    # Make the request
    operation = client.update_document(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)