Types for Google Developer Knowledge v1 API¶
- class google.developer_knowledge_v1.types.Answer(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageAn answer to a query.
- citations¶
Output only. Contains citations for the answer.
- Type
MutableSequence[google.developer_knowledge_v1.types.Answer.AnswerCitation]
- references¶
Output only. Contains references for the answer.
- Type
MutableSequence[google.developer_knowledge_v1.types.Answer.AnswerReference]
- class AnswerCitation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageCitation info for a segment.
- start_index¶
Output only. Indicates the start of the segment, measured in bytes (UTF-8 unicode), inclusive. If there are multi-byte characters, such as non-ASCII characters, the index measurement is longer than the string length.
- Type
- end_index¶
Output only. Indicates the end of the segment, measured in bytes (UTF-8 unicode), exclusive. If there are multi-byte characters, such as non-ASCII characters, the index measurement is longer than the string length.
- Type
- sources¶
Output only. Contains citation sources for the attributed segment.
- Type
MutableSequence[google.developer_knowledge_v1.types.Answer.CitationSource]
- class AnswerReference(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRepresents a reference to a source.
- class CitationSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageCitation source.
- class DocumentReference(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRepresents a reference to a document.
- document_chunk¶
Output only. Contains the document chunk. The
document_chunk.idfield is not set and will be empty.
- class google.developer_knowledge_v1.types.AnswerQueryRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRequest message for [DeveloperKnowledge.AnswerQuery][google.developers.knowledge.v1.DeveloperKnowledge.AnswerQuery].
- filter¶
Optional. Applies a strict filter to the search results used to ground the answer. The expression supports a subset of the syntax described at https://google.aip.dev/160.
Supported fields for filtering:
content_length_bytes(INTEGER): The length of theDocument.contentfield in bytes.data_source(STRING): The source of the document, e.g.docs.cloud.google.com. See https://developers.google.com/knowledge/reference/corpus-reference for the complete list of data sources in the corpus.update_time(TIMESTAMP): The timestamp of when the document was last meaningfully updated. A meaningful update is one that changes document’s markdown content or metadata.uri(STRING): The document URI, e.g.https://docs.cloud.google.com/bigquery/docs/tables.
INTEGER fields support
=,<,<=,>, and>=operators.STRING fields support
=(equals) and!=(not equals) operators for exact match on the whole string. Partial match, prefix match, and regexp match are not supported.TIMESTAMP fields support
=,<,<=,>, and>=operators. Timestamps must be in RFC-3339 format, e.g.,"2025-01-01T00:00:00Z".You can combine expressions using
AND,OR, andNOT(or-) logical operators.ORhas higher precedence thanAND. Use parentheses for explicit precedence grouping.Examples:
Filter by
Document.content_length_bytes:content_length_bytes < 50000data_source = "docs.cloud.google.com" OR data_source = "firebase.google.com"data_source != "firebase.google.com"update_time < "2024-01-01T00:00:00Z"update_time >= "2025-01-22T00:00:00Z" AND (data_source = "developer.chrome.com" OR data_source = "web.dev")uri = "https://docs.cloud.google.com/release-notes"
The
filterstring must not exceed 500 characters; values longer than 500 characters will result in anINVALID_ARGUMENTerror.- Type
- class google.developer_knowledge_v1.types.AnswerQueryResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageResponse message for [DeveloperKnowledge.AnswerQuery][google.developers.knowledge.v1.DeveloperKnowledge.AnswerQuery].
- answer¶
The answer to the query.
- class google.developer_knowledge_v1.types.BatchGetDocumentsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRequest message for [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments].
- names¶
Required. Specifies the names of the documents to retrieve. A maximum of 20 documents can be retrieved in a batch. The documents are returned in the same order as the
namesin the request.Format:
documents/{uri_without_scheme}Example:documents/docs.cloud.google.com/storage/docs/creating-bucketsEach name must not exceed 500 characters; values longer than 500 characters will result in an
INVALID_ARGUMENTerror.- Type
MutableSequence[str]
- view¶
Optional. Specifies the [DocumentView][google.developers.knowledge.v1.DocumentView] of the document. If unspecified, [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments] defaults to
DOCUMENT_VIEW_CONTENT.
- class google.developer_knowledge_v1.types.BatchGetDocumentsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageResponse message for [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments].
- documents¶
Contains the documents requested.
- Type
MutableSequence[google.developer_knowledge_v1.types.Document]
- class google.developer_knowledge_v1.types.Document(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageA Document represents a page of documentation in the Developer Knowledge corpus, like the page at https://docs.cloud.google.com/storage/docs/creating-buckets.
- name¶
Identifier. Contains the resource name of the document. Format:
documents/{uri_without_scheme}Example:documents/docs.cloud.google.com/storage/docs/creating-buckets- Type
- uri¶
Output only. Provides the URI of the content, such as
docs.cloud.google.com/storage/docs/creating-buckets.- Type
- data_source¶
Output only. Specifies the data source of the document. Example data source:
firebase.google.com- Type
- update_time¶
Output only. Represents the timestamp when the content or metadata of the document was last updated.
- view¶
Output only. Specifies the [DocumentView][google.developers.knowledge.v1.DocumentView] of the document.
- class google.developer_knowledge_v1.types.DocumentChunk(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageA DocumentChunk represents a piece of content from a [Document][google.developers.knowledge.v1.Document] in the DeveloperKnowledge corpus. To fetch the entire document content, pass the
parentto [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] or [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments].- parent¶
Output only. Contains the resource name of the document this chunk is from. Format:
documents/{uri_without_scheme}Example:documents/docs.cloud.google.com/storage/docs/creating-buckets- Type
- id¶
Output only. Specifies the ID of this chunk within the document. The chunk ID is unique within a document, but not globally unique across documents. The chunk ID is not stable and may change over time.
- Type
- document¶
Output only. Represents metadata about the [Document][google.developers.knowledge.v1.Document] this chunk is from. The [DocumentView][google.developers.knowledge.v1.DocumentView] of this [Document][google.developers.knowledge.v1.Document] message will be set to
DOCUMENT_VIEW_BASIC. It is included here for convenience so that clients do not need to call [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] or [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments] if they only need the metadata fields. Otherwise, clients should use [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] or [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments] to fetch the full document content.
- class google.developer_knowledge_v1.types.DocumentView(value)[source]¶
Bases:
proto.enums.EnumSpecifies which fields of the [Document][google.developers.knowledge.v1.Document] are included.
- Values:
- DOCUMENT_VIEW_UNSPECIFIED (0):
The default / unset value. See each API method for its default value if [DocumentView][google.developers.knowledge.v1.DocumentView] is not specified.
- DOCUMENT_VIEW_BASIC (1):
Includes only the basic metadata fields:
nameuridata_sourcetitledescriptionupdate_timeviewcontent_length_bytes
This is the default of view for [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1.DeveloperKnowledge.SearchDocumentChunks].
- DOCUMENT_VIEW_FULL (2):
Includes all [Document][google.developers.knowledge.v1.Document] fields.
- DOCUMENT_VIEW_CONTENT (3):
Includes the
DOCUMENT_VIEW_BASICfields and thecontentfield.This is the default of view for [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] and [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments].
- class google.developer_knowledge_v1.types.GetDocumentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRequest message for [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument].
- name¶
Required. Specifies the name of the document to retrieve. Format:
documents/{uri_without_scheme}Example:documents/docs.cloud.google.com/storage/docs/creating-bucketsThe name must not exceed 500 characters; values longer than 500 characters will result in an
INVALID_ARGUMENTerror.- Type
- view¶
Optional. Specifies the [DocumentView][google.developers.knowledge.v1.DocumentView] of the document. If unspecified, [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] defaults to
DOCUMENT_VIEW_CONTENT.
- class google.developer_knowledge_v1.types.SearchDocumentChunksRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageRequest message for [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1.DeveloperKnowledge.SearchDocumentChunks].
- query¶
Required. Provides the raw query string provided by the user, such as “How to create a Cloud Storage bucket?”. The query must not exceed 500 characters; values longer than 500 characters will result in an
INVALID_ARGUMENTerror.- Type
- page_size¶
Optional. Specifies the maximum number of results to return. The service may return fewer than this value.
If unspecified, at most 5 results will be returned.
The maximum value is 100; values above 100 will be coerced to 100.
- Type
- page_token¶
Optional. Contains a page token, received from a previous
SearchDocumentChunkscall. Provide this to retrieve the subsequent page.- Type
- filter¶
Optional. Applies a strict filter to the search results. The expression supports a subset of the syntax described at https://google.aip.dev/160.
While
SearchDocumentChunksreturns [DocumentChunk][google.developers.knowledge.v1.DocumentChunk]s, the filter is applied toDocumentChunk.documentfields.Supported fields for filtering:
content_length_bytes(INTEGER): The length of theDocument.contentfield in bytes.data_source(STRING): The source of the document, e.g.docs.cloud.google.com. See https://developers.google.com/knowledge/reference/corpus-reference for the complete list of data sources in the corpus.update_time(TIMESTAMP): The timestamp of when the document was last meaningfully updated. A meaningful update is one that changes document’s markdown content or metadata.uri(STRING): The document URI, e.g.https://docs.cloud.google.com/bigquery/docs/tables.
INTEGER fields support
=,<,<=,>, and>=operators.STRING fields support
=(equals) and!=(not equals) operators for exact match on the whole string. Partial match, prefix match, and regexp match are not supported.TIMESTAMP fields support
=,<,<=,>, and>=operators. Timestamps must be in RFC-3339 format, e.g.,"2025-01-01T00:00:00Z".Note: Field names must be in
snake_case(e.g.,data_source). Values on the right-hand side of filtering expressions must be string literals enclosed in double quotes (e.g.,"docs.cloud.google.com").You can combine expressions using
AND,OR, andNOT(or-) logical operators.ORhas higher precedence thanAND. Use parentheses for explicit precedence grouping.Examples:
Filter by
Document.content_length_bytes:content_length_bytes < 50000data_source = "docs.cloud.google.com" OR data_source = "firebase.google.com"data_source != "firebase.google.com"update_time < "2024-01-01T00:00:00Z"update_time >= "2025-01-22T00:00:00Z" AND (data_source = "developer.chrome.com" OR data_source = "web.dev")uri = "https://docs.cloud.google.com/release-notes"
The
filterstring must not exceed 500 characters; values longer than 500 characters will result in anINVALID_ARGUMENTerror.- Type
- class google.developer_knowledge_v1.types.SearchDocumentChunksResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
Bases:
proto.message.MessageResponse message for [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1.DeveloperKnowledge.SearchDocumentChunks].
- results¶
Contains the search results for the given query. Each [DocumentChunk][google.developers.knowledge.v1.DocumentChunk] in this list contains a snippet of content relevant to the search query. Use the [DocumentChunk.parent][google.developers.knowledge.v1.DocumentChunk.parent] field of each result with [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument] or [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1.DeveloperKnowledge.BatchGetDocuments] to retrieve the full document content.
- Type
MutableSequence[google.developer_knowledge_v1.types.DocumentChunk]