# Class Document (2.48.0)

2.48.0 (latest) 2.47.0 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.2 2.40.0 2.39.1 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.30.2 2.29.0 2.28.3 2.27.0 2.26.0 2.25.0 2.24.1 2.23.3 2.22.0 2.21.0 2.20.0 2.19.1 2.18.0 2.17.0 2.16.1 2.15.2 2.14.1 2.13.0 2.12.0 2.11.0 2.10.0 2.9.1 2.8.1 2.7.1 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.2 2.0.0 1.1.3 1.0.0 0.8.0 0.7.2

    Document(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A knowledge document to be used by a
KnowledgeBase.

For more information, see the `knowledge base
guide <https://cloud.google.com/dialogflow/docs/how/knowledge-bases>`__.

Note: The `projects.agent.knowledgeBases.documents` resource is
deprecated; only use `projects.knowledgeBases.documents`.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: <https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields>

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `name` | `str` Optional. The document resource name. The name must be empty when creating a document. Format: `projects/`. |
| `display_name` | `str` Required. The display name of the document. The name must be 1024 bytes or less; otherwise, the creation request fails. |
| `mime_type` | `str` Required. The MIME type of this document. |
| `knowledge_types` | `MutableSequence[https://docs.cloud.google.com/python/docs/reference/dialogflow/latest/google.cloud.dialogflow_v2.types.Document.KnowledgeType]` Required. The knowledge type of document content. |
| `content_uri` | `str` The URI where the file content is located. For documents stored in Google Cloud Storage, these URIs must have the form `gs://`. NOTE: External URLs must correspond to public webpages, i.e., they must be indexed by Google Search. In particular, URLs for showing documents in Google Cloud Storage (i.e. the URL in your browser) are not supported. Instead use the `gs://` format URI described above. This field is a member of `oneof`_ `source`. |
| `raw_content` | `bytes` The raw content of the document. This field is only permitted for EXTRACTIVE_QA and FAQ knowledge types. This field is a member of `oneof`_ `source`. |
| `enable_auto_reload` | `bool` Optional. If true, we try to automatically reload the document every day (at a time picked by the system). If false or unspecified, we don't try to automatically reload the document. Currently you can only enable automatic reload for documents sourced from a public url, see `source` field for the source types. Reload status can be tracked in `latest_reload_status`. If a reload fails, we will keep the document unchanged. If a reload fails with internal errors, the system will try to reload the document on the next day. If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the system will not try to reload the document anymore. You need to manually reload the document successfully by calling `ReloadDocument` and clear the errors. |
| `latest_reload_status` | `https://docs.cloud.google.com/python/docs/reference/dialogflow/latest/google.cloud.dialogflow_v2.types.Document.ReloadStatus` Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded. |
| `metadata` | `MutableMapping[str, str]` Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a `key` or a `value` of the metadata is 1024 bytes. |
| `state` | `https://docs.cloud.google.com/python/docs/reference/dialogflow/latest/google.cloud.dialogflow_v2.types.Document.State` Output only. The current state of the document. |

## Classes

### KnowledgeType

    KnowledgeType(value)

The knowledge type of document content.

        CSV must have questions in the first column and
        answers in the second, with no header. Because
        of this explicit format, they are always parsed
        accurately.
    EXTRACTIVE_QA (2):
        Documents for which unstructured text is
        extracted and used for question answering.
    ARTICLE_SUGGESTION (3):
        The entire document content as a whole can be
        used for query results. Only for Contact Center
        Solutions on Dialogflow.
    AGENT_FACING_SMART_REPLY (4):
        The document contains agent-facing Smart
        Reply entries.

### MetadataEntry

    MetadataEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `kwargs` | `dict` Keys and values corresponding to the fields of the message. |
| `mapping` | ``Union[dict, `.Message`]`` A dictionary or message to be used to determine the values for this message. |
| `ignore_unknown_fields` | `Optional(bool)` If True, do not raise errors for unknown fields. Only applied if `mapping` is a mapping type or there are keyword parameters. |

### ReloadStatus

    ReloadStatus(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The status of a reload attempt.

### State

    State(value)

Possible states of the document