google-developers-developer_knowledge-v1 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/developers/developer_knowledge/v1/developer_knowledge/client.rb +107 -6
- data/lib/google/developers/developer_knowledge/v1/developer_knowledge/rest/client.rb +108 -6
- data/lib/google/developers/developer_knowledge/v1/developer_knowledge/rest/service_stub.rb +61 -1
- data/lib/google/developers/developer_knowledge/v1/version.rb +1 -1
- data/lib/google/developers/knowledge/v1/developerknowledge_pb.rb +8 -1
- data/lib/google/developers/knowledge/v1/developerknowledge_services_pb.rb +3 -1
- data/proto_docs/google/developers/knowledge/v1/developerknowledge.rb +119 -8
- data/proto_docs/google/protobuf/timestamp.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e39d28858a3725dd67dfe8d7aea0c4ce8a1dbc2aeafec5f273e1360d1bf069cc
|
|
4
|
+
data.tar.gz: 9702a2a00a4fd8cd8f6ccca5ef8aefa4bcd3ce2ad50ab6c13b2b4bb98b777c30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4eaecdd5395b3257afec673ff1240184b44010d7dee8930ca4a00cf859305b8fc8594cc03594146e16e65a41624825d7ce43065a4c84b6b5c9e8c62e23de88e9
|
|
7
|
+
data.tar.gz: dac4247564d53215b6fb1ed812da60f443d4f9516005bf1dd0a7fe66bd68b8f00d38f7e07efebfa69900437f97e1fa8cbd96f2ecb043dc4559311a9516bce911
|
|
@@ -212,7 +212,7 @@ module Google
|
|
|
212
212
|
# Searches for developer knowledge across Google's developer documentation.
|
|
213
213
|
# Returns {::Google::Developers::DeveloperKnowledge::V1::DocumentChunk DocumentChunk}s
|
|
214
214
|
# based on the user's query. There may be many chunks from the same
|
|
215
|
-
# {::Google::Developers::DeveloperKnowledge::V1::Document Document}.
|
|
215
|
+
# {::Google::Developers::DeveloperKnowledge::V1::Document Document}. To retrieve full
|
|
216
216
|
# documents, use
|
|
217
217
|
# {::Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Client#get_document DeveloperKnowledge.GetDocument}
|
|
218
218
|
# or
|
|
@@ -239,15 +239,16 @@ module Google
|
|
|
239
239
|
#
|
|
240
240
|
# @param query [::String]
|
|
241
241
|
# Required. Provides the raw query string provided by the user, such as "How
|
|
242
|
-
# to create a Cloud Storage bucket?".
|
|
242
|
+
# to create a Cloud Storage bucket?". The query must not exceed 500
|
|
243
|
+
# characters; values longer than 500 characters will result in an
|
|
244
|
+
# `INVALID_ARGUMENT` error.
|
|
243
245
|
# @param page_size [::Integer]
|
|
244
246
|
# Optional. Specifies the maximum number of results to return. The service
|
|
245
247
|
# may return fewer than this value.
|
|
246
248
|
#
|
|
247
249
|
# If unspecified, at most 5 results will be returned.
|
|
248
250
|
#
|
|
249
|
-
# The maximum value is
|
|
250
|
-
# error.
|
|
251
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
|
251
252
|
# @param page_token [::String]
|
|
252
253
|
# Optional. Contains a page token, received from a previous
|
|
253
254
|
# `SearchDocumentChunks` call. Provide this to retrieve the subsequent page.
|
|
@@ -261,6 +262,8 @@ module Google
|
|
|
261
262
|
#
|
|
262
263
|
# Supported fields for filtering:
|
|
263
264
|
#
|
|
265
|
+
# * `content_length_bytes` (INTEGER): The length of the `Document.content`
|
|
266
|
+
# field in bytes.
|
|
264
267
|
# * `data_source` (STRING): The source of the document, e.g.
|
|
265
268
|
# `docs.cloud.google.com`. See
|
|
266
269
|
# https://developers.google.com/knowledge/reference/corpus-reference for
|
|
@@ -271,6 +274,8 @@ module Google
|
|
|
271
274
|
# * `uri` (STRING): The document URI, e.g.
|
|
272
275
|
# `https://docs.cloud.google.com/bigquery/docs/tables`.
|
|
273
276
|
#
|
|
277
|
+
# INTEGER fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
278
|
+
#
|
|
274
279
|
# STRING fields support `=` (equals) and `!=` (not equals) operators for
|
|
275
280
|
# **exact match** on the whole string. Partial match, prefix match, and
|
|
276
281
|
# regexp match are not supported.
|
|
@@ -278,18 +283,24 @@ module Google
|
|
|
278
283
|
# TIMESTAMP fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
279
284
|
# Timestamps must be in RFC-3339 format, e.g., `"2025-01-01T00:00:00Z"`.
|
|
280
285
|
#
|
|
286
|
+
# Note: Field names must be in `snake_case` (e.g., `data_source`). Values on
|
|
287
|
+
# the right-hand side of filtering expressions must be string literals
|
|
288
|
+
# enclosed in double quotes (e.g., `"docs.cloud.google.com"`).
|
|
289
|
+
#
|
|
281
290
|
# You can combine expressions using `AND`, `OR`, and `NOT` (or `-`) logical
|
|
282
291
|
# operators. `OR` has higher precedence than `AND`. Use parentheses for
|
|
283
292
|
# explicit precedence grouping.
|
|
284
293
|
#
|
|
285
294
|
# Examples:
|
|
286
295
|
#
|
|
296
|
+
# * Filter by `Document.content_length_bytes`:
|
|
297
|
+
# `content_length_bytes < 50000`
|
|
287
298
|
# * `data_source = "docs.cloud.google.com" OR data_source =
|
|
288
|
-
#
|
|
299
|
+
# "firebase.google.com"`
|
|
289
300
|
# * `data_source != "firebase.google.com"`
|
|
290
301
|
# * `update_time < "2024-01-01T00:00:00Z"`
|
|
291
302
|
# * `update_time >= "2025-01-22T00:00:00Z" AND (data_source =
|
|
292
|
-
#
|
|
303
|
+
# "developer.chrome.com" OR data_source = "web.dev")`
|
|
293
304
|
# * `uri = "https://docs.cloud.google.com/release-notes"`
|
|
294
305
|
#
|
|
295
306
|
# The `filter` string must not exceed 500 characters; values longer than 500
|
|
@@ -379,6 +390,9 @@ module Google
|
|
|
379
390
|
# Required. Specifies the name of the document to retrieve.
|
|
380
391
|
# Format: `documents/{uri_without_scheme}`
|
|
381
392
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
393
|
+
#
|
|
394
|
+
# The name must not exceed 500 characters; values longer than 500 characters
|
|
395
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
382
396
|
# @param view [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
383
397
|
# Optional. Specifies the
|
|
384
398
|
# {::Google::Developers::DeveloperKnowledge::V1::DocumentView DocumentView} of the
|
|
@@ -475,6 +489,9 @@ module Google
|
|
|
475
489
|
#
|
|
476
490
|
# Format: `documents/{uri_without_scheme}`
|
|
477
491
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
492
|
+
#
|
|
493
|
+
# Each name must not exceed 500 characters; values longer than 500 characters
|
|
494
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
478
495
|
# @param view [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
479
496
|
# Optional. Specifies the
|
|
480
497
|
# {::Google::Developers::DeveloperKnowledge::V1::DocumentView DocumentView} of the
|
|
@@ -538,6 +555,83 @@ module Google
|
|
|
538
555
|
raise ::Google::Cloud::Error.from_error(e)
|
|
539
556
|
end
|
|
540
557
|
|
|
558
|
+
##
|
|
559
|
+
# Answers a query using grounded generation.
|
|
560
|
+
#
|
|
561
|
+
# @overload answer_query(request, options = nil)
|
|
562
|
+
# Pass arguments to `answer_query` via a request object, either of type
|
|
563
|
+
# {::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest} or an equivalent Hash.
|
|
564
|
+
#
|
|
565
|
+
# @param request [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest, ::Hash]
|
|
566
|
+
# A request object representing the call parameters. Required. To specify no
|
|
567
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
568
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
569
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
570
|
+
#
|
|
571
|
+
# @overload answer_query(query: nil)
|
|
572
|
+
# Pass arguments to `answer_query` via keyword arguments. Note that at
|
|
573
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
574
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
575
|
+
#
|
|
576
|
+
# @param query [::String]
|
|
577
|
+
# Required. The query to answer.
|
|
578
|
+
#
|
|
579
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
580
|
+
# @yieldparam response [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
581
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
582
|
+
#
|
|
583
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
584
|
+
#
|
|
585
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
586
|
+
#
|
|
587
|
+
# @example Basic example
|
|
588
|
+
# require "google/developers/developer_knowledge/v1"
|
|
589
|
+
#
|
|
590
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
591
|
+
# client = Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Client.new
|
|
592
|
+
#
|
|
593
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
594
|
+
# request = Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest.new
|
|
595
|
+
#
|
|
596
|
+
# # Call the answer_query method.
|
|
597
|
+
# result = client.answer_query request
|
|
598
|
+
#
|
|
599
|
+
# # The returned object is of type Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse.
|
|
600
|
+
# p result
|
|
601
|
+
#
|
|
602
|
+
def answer_query request, options = nil
|
|
603
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
604
|
+
|
|
605
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest
|
|
606
|
+
|
|
607
|
+
# Converts hash and nil to an options object
|
|
608
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
609
|
+
|
|
610
|
+
# Customize the options with defaults
|
|
611
|
+
metadata = @config.rpcs.answer_query.metadata.to_h
|
|
612
|
+
|
|
613
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
614
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
615
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
616
|
+
gapic_version: ::Google::Developers::DeveloperKnowledge::V1::VERSION
|
|
617
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
618
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
619
|
+
|
|
620
|
+
options.apply_defaults timeout: @config.rpcs.answer_query.timeout,
|
|
621
|
+
metadata: metadata,
|
|
622
|
+
retry_policy: @config.rpcs.answer_query.retry_policy
|
|
623
|
+
|
|
624
|
+
options.apply_defaults timeout: @config.timeout,
|
|
625
|
+
metadata: @config.metadata,
|
|
626
|
+
retry_policy: @config.retry_policy
|
|
627
|
+
|
|
628
|
+
@developer_knowledge_stub.call_rpc :answer_query, request, options: options do |response, operation|
|
|
629
|
+
yield response, operation if block_given?
|
|
630
|
+
end
|
|
631
|
+
rescue ::GRPC::BadStatus => e
|
|
632
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
633
|
+
end
|
|
634
|
+
|
|
541
635
|
##
|
|
542
636
|
# Configuration class for the DeveloperKnowledge API.
|
|
543
637
|
#
|
|
@@ -738,6 +832,11 @@ module Google
|
|
|
738
832
|
# @return [::Gapic::Config::Method]
|
|
739
833
|
#
|
|
740
834
|
attr_reader :batch_get_documents
|
|
835
|
+
##
|
|
836
|
+
# RPC-specific configuration for `answer_query`
|
|
837
|
+
# @return [::Gapic::Config::Method]
|
|
838
|
+
#
|
|
839
|
+
attr_reader :answer_query
|
|
741
840
|
|
|
742
841
|
# @private
|
|
743
842
|
def initialize parent_rpcs = nil
|
|
@@ -747,6 +846,8 @@ module Google
|
|
|
747
846
|
@get_document = ::Gapic::Config::Method.new get_document_config
|
|
748
847
|
batch_get_documents_config = parent_rpcs.batch_get_documents if parent_rpcs.respond_to? :batch_get_documents
|
|
749
848
|
@batch_get_documents = ::Gapic::Config::Method.new batch_get_documents_config
|
|
849
|
+
answer_query_config = parent_rpcs.answer_query if parent_rpcs.respond_to? :answer_query
|
|
850
|
+
@answer_query = ::Gapic::Config::Method.new answer_query_config
|
|
750
851
|
|
|
751
852
|
yield self if block_given?
|
|
752
853
|
end
|
|
@@ -205,7 +205,7 @@ module Google
|
|
|
205
205
|
# Searches for developer knowledge across Google's developer documentation.
|
|
206
206
|
# Returns {::Google::Developers::DeveloperKnowledge::V1::DocumentChunk DocumentChunk}s
|
|
207
207
|
# based on the user's query. There may be many chunks from the same
|
|
208
|
-
# {::Google::Developers::DeveloperKnowledge::V1::Document Document}.
|
|
208
|
+
# {::Google::Developers::DeveloperKnowledge::V1::Document Document}. To retrieve full
|
|
209
209
|
# documents, use
|
|
210
210
|
# {::Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Rest::Client#get_document DeveloperKnowledge.GetDocument}
|
|
211
211
|
# or
|
|
@@ -232,15 +232,16 @@ module Google
|
|
|
232
232
|
#
|
|
233
233
|
# @param query [::String]
|
|
234
234
|
# Required. Provides the raw query string provided by the user, such as "How
|
|
235
|
-
# to create a Cloud Storage bucket?".
|
|
235
|
+
# to create a Cloud Storage bucket?". The query must not exceed 500
|
|
236
|
+
# characters; values longer than 500 characters will result in an
|
|
237
|
+
# `INVALID_ARGUMENT` error.
|
|
236
238
|
# @param page_size [::Integer]
|
|
237
239
|
# Optional. Specifies the maximum number of results to return. The service
|
|
238
240
|
# may return fewer than this value.
|
|
239
241
|
#
|
|
240
242
|
# If unspecified, at most 5 results will be returned.
|
|
241
243
|
#
|
|
242
|
-
# The maximum value is
|
|
243
|
-
# error.
|
|
244
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
|
244
245
|
# @param page_token [::String]
|
|
245
246
|
# Optional. Contains a page token, received from a previous
|
|
246
247
|
# `SearchDocumentChunks` call. Provide this to retrieve the subsequent page.
|
|
@@ -254,6 +255,8 @@ module Google
|
|
|
254
255
|
#
|
|
255
256
|
# Supported fields for filtering:
|
|
256
257
|
#
|
|
258
|
+
# * `content_length_bytes` (INTEGER): The length of the `Document.content`
|
|
259
|
+
# field in bytes.
|
|
257
260
|
# * `data_source` (STRING): The source of the document, e.g.
|
|
258
261
|
# `docs.cloud.google.com`. See
|
|
259
262
|
# https://developers.google.com/knowledge/reference/corpus-reference for
|
|
@@ -264,6 +267,8 @@ module Google
|
|
|
264
267
|
# * `uri` (STRING): The document URI, e.g.
|
|
265
268
|
# `https://docs.cloud.google.com/bigquery/docs/tables`.
|
|
266
269
|
#
|
|
270
|
+
# INTEGER fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
271
|
+
#
|
|
267
272
|
# STRING fields support `=` (equals) and `!=` (not equals) operators for
|
|
268
273
|
# **exact match** on the whole string. Partial match, prefix match, and
|
|
269
274
|
# regexp match are not supported.
|
|
@@ -271,18 +276,24 @@ module Google
|
|
|
271
276
|
# TIMESTAMP fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
272
277
|
# Timestamps must be in RFC-3339 format, e.g., `"2025-01-01T00:00:00Z"`.
|
|
273
278
|
#
|
|
279
|
+
# Note: Field names must be in `snake_case` (e.g., `data_source`). Values on
|
|
280
|
+
# the right-hand side of filtering expressions must be string literals
|
|
281
|
+
# enclosed in double quotes (e.g., `"docs.cloud.google.com"`).
|
|
282
|
+
#
|
|
274
283
|
# You can combine expressions using `AND`, `OR`, and `NOT` (or `-`) logical
|
|
275
284
|
# operators. `OR` has higher precedence than `AND`. Use parentheses for
|
|
276
285
|
# explicit precedence grouping.
|
|
277
286
|
#
|
|
278
287
|
# Examples:
|
|
279
288
|
#
|
|
289
|
+
# * Filter by `Document.content_length_bytes`:
|
|
290
|
+
# `content_length_bytes < 50000`
|
|
280
291
|
# * `data_source = "docs.cloud.google.com" OR data_source =
|
|
281
|
-
#
|
|
292
|
+
# "firebase.google.com"`
|
|
282
293
|
# * `data_source != "firebase.google.com"`
|
|
283
294
|
# * `update_time < "2024-01-01T00:00:00Z"`
|
|
284
295
|
# * `update_time >= "2025-01-22T00:00:00Z" AND (data_source =
|
|
285
|
-
#
|
|
296
|
+
# "developer.chrome.com" OR data_source = "web.dev")`
|
|
286
297
|
# * `uri = "https://docs.cloud.google.com/release-notes"`
|
|
287
298
|
#
|
|
288
299
|
# The `filter` string must not exceed 500 characters; values longer than 500
|
|
@@ -373,6 +384,9 @@ module Google
|
|
|
373
384
|
# Required. Specifies the name of the document to retrieve.
|
|
374
385
|
# Format: `documents/{uri_without_scheme}`
|
|
375
386
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
387
|
+
#
|
|
388
|
+
# The name must not exceed 500 characters; values longer than 500 characters
|
|
389
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
376
390
|
# @param view [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
377
391
|
# Optional. Specifies the
|
|
378
392
|
# {::Google::Developers::DeveloperKnowledge::V1::DocumentView DocumentView} of the
|
|
@@ -462,6 +476,9 @@ module Google
|
|
|
462
476
|
#
|
|
463
477
|
# Format: `documents/{uri_without_scheme}`
|
|
464
478
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
479
|
+
#
|
|
480
|
+
# Each name must not exceed 500 characters; values longer than 500 characters
|
|
481
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
465
482
|
# @param view [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
466
483
|
# Optional. Specifies the
|
|
467
484
|
# {::Google::Developers::DeveloperKnowledge::V1::DocumentView DocumentView} of the
|
|
@@ -526,6 +543,84 @@ module Google
|
|
|
526
543
|
raise ::Google::Cloud::Error.from_error(e)
|
|
527
544
|
end
|
|
528
545
|
|
|
546
|
+
##
|
|
547
|
+
# Answers a query using grounded generation.
|
|
548
|
+
#
|
|
549
|
+
# @overload answer_query(request, options = nil)
|
|
550
|
+
# Pass arguments to `answer_query` via a request object, either of type
|
|
551
|
+
# {::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest} or an equivalent Hash.
|
|
552
|
+
#
|
|
553
|
+
# @param request [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest, ::Hash]
|
|
554
|
+
# A request object representing the call parameters. Required. To specify no
|
|
555
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
556
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
557
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
558
|
+
#
|
|
559
|
+
# @overload answer_query(query: nil)
|
|
560
|
+
# Pass arguments to `answer_query` via keyword arguments. Note that at
|
|
561
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
562
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
563
|
+
#
|
|
564
|
+
# @param query [::String]
|
|
565
|
+
# Required. The query to answer.
|
|
566
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
567
|
+
# @yieldparam result [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
568
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
569
|
+
#
|
|
570
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
571
|
+
#
|
|
572
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
573
|
+
#
|
|
574
|
+
# @example Basic example
|
|
575
|
+
# require "google/developers/developer_knowledge/v1"
|
|
576
|
+
#
|
|
577
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
578
|
+
# client = Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Rest::Client.new
|
|
579
|
+
#
|
|
580
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
581
|
+
# request = Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest.new
|
|
582
|
+
#
|
|
583
|
+
# # Call the answer_query method.
|
|
584
|
+
# result = client.answer_query request
|
|
585
|
+
#
|
|
586
|
+
# # The returned object is of type Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse.
|
|
587
|
+
# p result
|
|
588
|
+
#
|
|
589
|
+
def answer_query request, options = nil
|
|
590
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
591
|
+
|
|
592
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest
|
|
593
|
+
|
|
594
|
+
# Converts hash and nil to an options object
|
|
595
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
596
|
+
|
|
597
|
+
# Customize the options with defaults
|
|
598
|
+
call_metadata = @config.rpcs.answer_query.metadata.to_h
|
|
599
|
+
|
|
600
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
601
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
602
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
603
|
+
gapic_version: ::Google::Developers::DeveloperKnowledge::V1::VERSION,
|
|
604
|
+
transports_version_send: [:rest]
|
|
605
|
+
|
|
606
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
607
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
608
|
+
|
|
609
|
+
options.apply_defaults timeout: @config.rpcs.answer_query.timeout,
|
|
610
|
+
metadata: call_metadata,
|
|
611
|
+
retry_policy: @config.rpcs.answer_query.retry_policy
|
|
612
|
+
|
|
613
|
+
options.apply_defaults timeout: @config.timeout,
|
|
614
|
+
metadata: @config.metadata,
|
|
615
|
+
retry_policy: @config.retry_policy
|
|
616
|
+
|
|
617
|
+
@developer_knowledge_stub.answer_query request, options do |result, operation|
|
|
618
|
+
yield result, operation if block_given?
|
|
619
|
+
end
|
|
620
|
+
rescue ::Gapic::Rest::Error => e
|
|
621
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
622
|
+
end
|
|
623
|
+
|
|
529
624
|
##
|
|
530
625
|
# Configuration class for the DeveloperKnowledge REST API.
|
|
531
626
|
#
|
|
@@ -689,6 +784,11 @@ module Google
|
|
|
689
784
|
# @return [::Gapic::Config::Method]
|
|
690
785
|
#
|
|
691
786
|
attr_reader :batch_get_documents
|
|
787
|
+
##
|
|
788
|
+
# RPC-specific configuration for `answer_query`
|
|
789
|
+
# @return [::Gapic::Config::Method]
|
|
790
|
+
#
|
|
791
|
+
attr_reader :answer_query
|
|
692
792
|
|
|
693
793
|
# @private
|
|
694
794
|
def initialize parent_rpcs = nil
|
|
@@ -698,6 +798,8 @@ module Google
|
|
|
698
798
|
@get_document = ::Gapic::Config::Method.new get_document_config
|
|
699
799
|
batch_get_documents_config = parent_rpcs.batch_get_documents if parent_rpcs.respond_to? :batch_get_documents
|
|
700
800
|
@batch_get_documents = ::Gapic::Config::Method.new batch_get_documents_config
|
|
801
|
+
answer_query_config = parent_rpcs.answer_query if parent_rpcs.respond_to? :answer_query
|
|
802
|
+
@answer_query = ::Gapic::Config::Method.new answer_query_config
|
|
701
803
|
|
|
702
804
|
yield self if block_given?
|
|
703
805
|
end
|
|
@@ -193,6 +193,46 @@ module Google
|
|
|
193
193
|
end
|
|
194
194
|
end
|
|
195
195
|
|
|
196
|
+
##
|
|
197
|
+
# Baseline implementation for the answer_query REST call
|
|
198
|
+
#
|
|
199
|
+
# @param request_pb [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest]
|
|
200
|
+
# A request object representing the call parameters. Required.
|
|
201
|
+
# @param options [::Gapic::CallOptions]
|
|
202
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
203
|
+
#
|
|
204
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
205
|
+
# @yieldparam result [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
206
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
207
|
+
#
|
|
208
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse]
|
|
209
|
+
# A result object deserialized from the server's reply
|
|
210
|
+
def answer_query request_pb, options = nil
|
|
211
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
|
212
|
+
|
|
213
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_answer_query_request request_pb
|
|
214
|
+
query_string_params = if query_string_params.any?
|
|
215
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
|
216
|
+
else
|
|
217
|
+
{}
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
response = @client_stub.make_http_request(
|
|
221
|
+
verb,
|
|
222
|
+
uri: uri,
|
|
223
|
+
body: body || "",
|
|
224
|
+
params: query_string_params,
|
|
225
|
+
method_name: "answer_query",
|
|
226
|
+
options: options
|
|
227
|
+
)
|
|
228
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
|
229
|
+
result = ::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse.decode_json response.body, ignore_unknown_fields: true
|
|
230
|
+
catch :response do
|
|
231
|
+
yield result, operation if block_given?
|
|
232
|
+
result
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
196
236
|
##
|
|
197
237
|
# @private
|
|
198
238
|
#
|
|
@@ -227,7 +267,7 @@ module Google
|
|
|
227
267
|
uri_method: :get,
|
|
228
268
|
uri_template: "/v1/{name}",
|
|
229
269
|
matches: [
|
|
230
|
-
["name", %r{^documents(
|
|
270
|
+
["name", %r{^documents(?:/(?<__wildcard__>.*))?$}, true]
|
|
231
271
|
]
|
|
232
272
|
)
|
|
233
273
|
transcoder.transcode request_pb
|
|
@@ -251,6 +291,26 @@ module Google
|
|
|
251
291
|
)
|
|
252
292
|
transcoder.transcode request_pb
|
|
253
293
|
end
|
|
294
|
+
|
|
295
|
+
##
|
|
296
|
+
# @private
|
|
297
|
+
#
|
|
298
|
+
# GRPC transcoding helper method for the answer_query REST call
|
|
299
|
+
#
|
|
300
|
+
# @param request_pb [::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest]
|
|
301
|
+
# A request object representing the call parameters. Required.
|
|
302
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
|
303
|
+
# Uri, Body, Query string parameters
|
|
304
|
+
def self.transcode_answer_query_request request_pb
|
|
305
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
|
306
|
+
.with_bindings(
|
|
307
|
+
uri_method: :post,
|
|
308
|
+
uri_template: "/v1:answerQuery",
|
|
309
|
+
body: "*",
|
|
310
|
+
matches: []
|
|
311
|
+
)
|
|
312
|
+
transcoder.transcode request_pb
|
|
313
|
+
end
|
|
254
314
|
end
|
|
255
315
|
end
|
|
256
316
|
end
|
|
@@ -11,7 +11,7 @@ require 'google/api/resource_pb'
|
|
|
11
11
|
require 'google/protobuf/timestamp_pb'
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
descriptor_data = "\n7google/developers/knowledge/v1/developerknowledge.proto\x12\x1egoogle.developers.knowledge.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\
|
|
14
|
+
descriptor_data = "\n7google/developers/knowledge/v1/developerknowledge.proto\x12\x1egoogle.developers.knowledge.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x83\x03\n\x08\x44ocument\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12\x10\n\x03uri\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x14\n\x07\x63ontent\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x64\x65scription\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x64\x61ta_source\x18\x05 \x01(\tB\x03\xe0\x41\x03\x12\x12\n\x05title\x18\x06 \x01(\tB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12?\n\x04view\x18\x08 \x01(\x0e\x32,.google.developers.knowledge.v1.DocumentViewB\x03\xe0\x41\x03\x12!\n\x14\x63ontent_length_bytes\x18\t \x01(\x05\x42\x03\xe0\x41\x03:Z\xea\x41W\n*developerknowledge.googleapis.com/Document\x12\x14\x64ocuments/{document}*\tdocuments2\x08\x64ocument\"w\n\x1bSearchDocumentChunksRequest\x12\x12\n\x05query\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"w\n\x1cSearchDocumentChunksResponse\x12>\n\x07results\x18\x01 \x03(\x0b\x32-.google.developers.knowledge.v1.DocumentChunk\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x97\x01\n\x12GetDocumentRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*developerknowledge.googleapis.com/Document\x12?\n\x04view\x18\x02 \x01(\x0e\x32,.google.developers.knowledge.v1.DocumentViewB\x03\xe0\x41\x01\"\x9e\x01\n\x18\x42\x61tchGetDocumentsRequest\x12\x41\n\x05names\x18\x01 \x03(\tB2\xe0\x41\x02\xfa\x41,\n*developerknowledge.googleapis.com/Document\x12?\n\x04view\x18\x02 \x01(\x0e\x32,.google.developers.knowledge.v1.DocumentViewB\x03\xe0\x41\x01\"X\n\x19\x42\x61tchGetDocumentsResponse\x12;\n\tdocuments\x18\x01 \x03(\x0b\x32(.google.developers.knowledge.v1.Document\"(\n\x12\x41nswerQueryRequest\x12\x12\n\x05query\x18\x01 \x01(\tB\x03\xe0\x41\x02\"M\n\x13\x41nswerQueryResponse\x12\x36\n\x06\x61nswer\x18\x01 \x01(\x0b\x32&.google.developers.knowledge.v1.Answer\"\xdb\x04\n\x06\x41nswer\x12\x13\n\x0b\x61nswer_text\x18\x01 \x01(\t\x12M\n\tcitations\x18\x02 \x03(\x0b\x32\x35.google.developers.knowledge.v1.Answer.AnswerCitationB\x03\xe0\x41\x03\x12O\n\nreferences\x18\x03 \x03(\x0b\x32\x36.google.developers.knowledge.v1.Answer.AnswerReferenceB\x03\xe0\x41\x03\x1a\x8f\x01\n\x0e\x41nswerCitation\x12\x18\n\x0bstart_index\x18\x01 \x01(\x05\x42\x03\xe0\x41\x03\x12\x16\n\tend_index\x18\x02 \x01(\x05\x42\x03\xe0\x41\x03\x12K\n\x07sources\x18\x03 \x03(\x0b\x32\x35.google.developers.knowledge.v1.Answer.CitationSourceB\x03\xe0\x41\x03\x1a.\n\x0e\x43itationSource\x12\x1c\n\x0freference_index\x18\x01 \x01(\x05\x42\x03\xe0\x41\x03\x1ay\n\x0f\x41nswerReference\x12[\n\x12\x64ocument_reference\x18\x01 \x01(\x0b\x32\x38.google.developers.knowledge.v1.Answer.DocumentReferenceB\x03\xe0\x41\x03H\x00\x42\t\n\x07\x63ontent\x1a_\n\x11\x44ocumentReference\x12J\n\x0e\x64ocument_chunk\x18\x01 \x01(\x0b\x32-.google.developers.knowledge.v1.DocumentChunkB\x03\xe0\x41\x03\"\xbb\x01\n\rDocumentChunk\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x03\xfa\x41,\n*developerknowledge.googleapis.com/Document\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x14\n\x07\x63ontent\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12?\n\x08\x64ocument\x18\x04 \x01(\x0b\x32(.google.developers.knowledge.v1.DocumentB\x03\xe0\x41\x03*y\n\x0c\x44ocumentView\x12\x1d\n\x19\x44OCUMENT_VIEW_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44OCUMENT_VIEW_BASIC\x10\x01\x12\x16\n\x12\x44OCUMENT_VIEW_FULL\x10\x02\x12\x19\n\x15\x44OCUMENT_VIEW_CONTENT\x10\x03\x32\x81\x06\n\x12\x44\x65veloperKnowledge\x12\xbd\x01\n\x14SearchDocumentChunks\x12;.google.developers.knowledge.v1.SearchDocumentChunksRequest\x1a<.google.developers.knowledge.v1.SearchDocumentChunksResponse\"*\x82\xd3\xe4\x93\x02$\x12\"/v1/documents:searchDocumentChunks\x12\x93\x01\n\x0bGetDocument\x12\x32.google.developers.knowledge.v1.GetDocumentRequest\x1a(.google.developers.knowledge.v1.Document\"&\xda\x41\x04name\x82\xd3\xe4\x93\x02\x19\x12\x17/v1/{name=documents/**}\x12\xa8\x01\n\x11\x42\x61tchGetDocuments\x12\x38.google.developers.knowledge.v1.BatchGetDocumentsRequest\x1a\x39.google.developers.knowledge.v1.BatchGetDocumentsResponse\"\x1e\x82\xd3\xe4\x93\x02\x18\x12\x16/v1/documents:batchGet\x12\x92\x01\n\x0b\x41nswerQuery\x12\x32.google.developers.knowledge.v1.AnswerQueryRequest\x1a\x33.google.developers.knowledge.v1.AnswerQueryResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\"\x0f/v1:answerQuery:\x01*\x1aU\xca\x41!developerknowledge.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x83\x02\n\"com.google.developers.knowledge.v1B\x17\x44\x65veloperKnowledgeProtoP\x01ZAcloud.google.com/go/developerknowledge/apiv1/developerknowledgepb\xaa\x02\'Google.Developers.DeveloperKnowledge.V1\xca\x02\'Google\\Developers\\DeveloperKnowledge\\V1\xea\x02*Google::Developers::DeveloperKnowledge::V1b\x06proto3"
|
|
15
15
|
|
|
16
16
|
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
17
17
|
pool.add_serialized_file(descriptor_data)
|
|
@@ -26,6 +26,13 @@ module Google
|
|
|
26
26
|
GetDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.GetDocumentRequest").msgclass
|
|
27
27
|
BatchGetDocumentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.BatchGetDocumentsRequest").msgclass
|
|
28
28
|
BatchGetDocumentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.BatchGetDocumentsResponse").msgclass
|
|
29
|
+
AnswerQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.AnswerQueryRequest").msgclass
|
|
30
|
+
AnswerQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.AnswerQueryResponse").msgclass
|
|
31
|
+
Answer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.Answer").msgclass
|
|
32
|
+
Answer::AnswerCitation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.Answer.AnswerCitation").msgclass
|
|
33
|
+
Answer::CitationSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.Answer.CitationSource").msgclass
|
|
34
|
+
Answer::AnswerReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.Answer.AnswerReference").msgclass
|
|
35
|
+
Answer::DocumentReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.Answer.DocumentReference").msgclass
|
|
29
36
|
DocumentChunk = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.DocumentChunk").msgclass
|
|
30
37
|
DocumentView = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.developers.knowledge.v1.DocumentView").enummodule
|
|
31
38
|
end
|
|
@@ -51,7 +51,7 @@ module Google
|
|
|
51
51
|
# Searches for developer knowledge across Google's developer documentation.
|
|
52
52
|
# Returns [DocumentChunk][google.developers.knowledge.v1.DocumentChunk]s
|
|
53
53
|
# based on the user's query. There may be many chunks from the same
|
|
54
|
-
# [Document][google.developers.knowledge.v1.Document].
|
|
54
|
+
# [Document][google.developers.knowledge.v1.Document]. To retrieve full
|
|
55
55
|
# documents, use
|
|
56
56
|
# [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1.DeveloperKnowledge.GetDocument]
|
|
57
57
|
# or
|
|
@@ -65,6 +65,8 @@ module Google
|
|
|
65
65
|
rpc :GetDocument, ::Google::Developers::DeveloperKnowledge::V1::GetDocumentRequest, ::Google::Developers::DeveloperKnowledge::V1::Document
|
|
66
66
|
# Retrieves multiple documents, each with its full Markdown content.
|
|
67
67
|
rpc :BatchGetDocuments, ::Google::Developers::DeveloperKnowledge::V1::BatchGetDocumentsRequest, ::Google::Developers::DeveloperKnowledge::V1::BatchGetDocumentsResponse
|
|
68
|
+
# Answers a query using grounded generation.
|
|
69
|
+
rpc :AnswerQuery, ::Google::Developers::DeveloperKnowledge::V1::AnswerQueryRequest, ::Google::Developers::DeveloperKnowledge::V1::AnswerQueryResponse
|
|
68
70
|
end
|
|
69
71
|
|
|
70
72
|
Stub = Service.rpc_stub_class
|
|
@@ -21,7 +21,9 @@ module Google
|
|
|
21
21
|
module Developers
|
|
22
22
|
module DeveloperKnowledge
|
|
23
23
|
module V1
|
|
24
|
-
# A Document represents a
|
|
24
|
+
# A Document represents a page of documentation in the Developer Knowledge
|
|
25
|
+
# corpus, like the page at
|
|
26
|
+
# https://docs.cloud.google.com/storage/docs/creating-buckets.
|
|
25
27
|
# @!attribute [rw] name
|
|
26
28
|
# @return [::String]
|
|
27
29
|
# Identifier. Contains the resource name of the document.
|
|
@@ -53,6 +55,9 @@ module Google
|
|
|
53
55
|
# Output only. Specifies the
|
|
54
56
|
# {::Google::Developers::DeveloperKnowledge::V1::DocumentView DocumentView} of the
|
|
55
57
|
# document.
|
|
58
|
+
# @!attribute [r] content_length_bytes
|
|
59
|
+
# @return [::Integer]
|
|
60
|
+
# Output only. The length of the `content` field in bytes.
|
|
56
61
|
class Document
|
|
57
62
|
include ::Google::Protobuf::MessageExts
|
|
58
63
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
@@ -63,7 +68,9 @@ module Google
|
|
|
63
68
|
# @!attribute [rw] query
|
|
64
69
|
# @return [::String]
|
|
65
70
|
# Required. Provides the raw query string provided by the user, such as "How
|
|
66
|
-
# to create a Cloud Storage bucket?".
|
|
71
|
+
# to create a Cloud Storage bucket?". The query must not exceed 500
|
|
72
|
+
# characters; values longer than 500 characters will result in an
|
|
73
|
+
# `INVALID_ARGUMENT` error.
|
|
67
74
|
# @!attribute [rw] page_size
|
|
68
75
|
# @return [::Integer]
|
|
69
76
|
# Optional. Specifies the maximum number of results to return. The service
|
|
@@ -71,8 +78,7 @@ module Google
|
|
|
71
78
|
#
|
|
72
79
|
# If unspecified, at most 5 results will be returned.
|
|
73
80
|
#
|
|
74
|
-
# The maximum value is
|
|
75
|
-
# error.
|
|
81
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
|
76
82
|
# @!attribute [rw] page_token
|
|
77
83
|
# @return [::String]
|
|
78
84
|
# Optional. Contains a page token, received from a previous
|
|
@@ -88,6 +94,8 @@ module Google
|
|
|
88
94
|
#
|
|
89
95
|
# Supported fields for filtering:
|
|
90
96
|
#
|
|
97
|
+
# * `content_length_bytes` (INTEGER): The length of the `Document.content`
|
|
98
|
+
# field in bytes.
|
|
91
99
|
# * `data_source` (STRING): The source of the document, e.g.
|
|
92
100
|
# `docs.cloud.google.com`. See
|
|
93
101
|
# https://developers.google.com/knowledge/reference/corpus-reference for
|
|
@@ -98,6 +106,8 @@ module Google
|
|
|
98
106
|
# * `uri` (STRING): The document URI, e.g.
|
|
99
107
|
# `https://docs.cloud.google.com/bigquery/docs/tables`.
|
|
100
108
|
#
|
|
109
|
+
# INTEGER fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
110
|
+
#
|
|
101
111
|
# STRING fields support `=` (equals) and `!=` (not equals) operators for
|
|
102
112
|
# **exact match** on the whole string. Partial match, prefix match, and
|
|
103
113
|
# regexp match are not supported.
|
|
@@ -105,18 +115,24 @@ module Google
|
|
|
105
115
|
# TIMESTAMP fields support `=`, `<`, `<=`, `>`, and `>=` operators.
|
|
106
116
|
# Timestamps must be in RFC-3339 format, e.g., `"2025-01-01T00:00:00Z"`.
|
|
107
117
|
#
|
|
118
|
+
# Note: Field names must be in `snake_case` (e.g., `data_source`). Values on
|
|
119
|
+
# the right-hand side of filtering expressions must be string literals
|
|
120
|
+
# enclosed in double quotes (e.g., `"docs.cloud.google.com"`).
|
|
121
|
+
#
|
|
108
122
|
# You can combine expressions using `AND`, `OR`, and `NOT` (or `-`) logical
|
|
109
123
|
# operators. `OR` has higher precedence than `AND`. Use parentheses for
|
|
110
124
|
# explicit precedence grouping.
|
|
111
125
|
#
|
|
112
126
|
# Examples:
|
|
113
127
|
#
|
|
128
|
+
# * Filter by `Document.content_length_bytes`:
|
|
129
|
+
# `content_length_bytes < 50000`
|
|
114
130
|
# * `data_source = "docs.cloud.google.com" OR data_source =
|
|
115
|
-
#
|
|
131
|
+
# "firebase.google.com"`
|
|
116
132
|
# * `data_source != "firebase.google.com"`
|
|
117
133
|
# * `update_time < "2024-01-01T00:00:00Z"`
|
|
118
134
|
# * `update_time >= "2025-01-22T00:00:00Z" AND (data_source =
|
|
119
|
-
#
|
|
135
|
+
# "developer.chrome.com" OR data_source = "web.dev")`
|
|
120
136
|
# * `uri = "https://docs.cloud.google.com/release-notes"`
|
|
121
137
|
#
|
|
122
138
|
# The `filter` string must not exceed 500 characters; values longer than 500
|
|
@@ -141,8 +157,9 @@ module Google
|
|
|
141
157
|
# to retrieve the full document content.
|
|
142
158
|
# @!attribute [rw] next_page_token
|
|
143
159
|
# @return [::String]
|
|
144
|
-
#
|
|
145
|
-
#
|
|
160
|
+
# Provides a token that can be sent as `page_token` to retrieve the next
|
|
161
|
+
# page.
|
|
162
|
+
# If this field is omitted, there are no subsequent pages.
|
|
146
163
|
class SearchDocumentChunksResponse
|
|
147
164
|
include ::Google::Protobuf::MessageExts
|
|
148
165
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
@@ -155,6 +172,9 @@ module Google
|
|
|
155
172
|
# Required. Specifies the name of the document to retrieve.
|
|
156
173
|
# Format: `documents/{uri_without_scheme}`
|
|
157
174
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
175
|
+
#
|
|
176
|
+
# The name must not exceed 500 characters; values longer than 500 characters
|
|
177
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
158
178
|
# @!attribute [rw] view
|
|
159
179
|
# @return [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
160
180
|
# Optional. Specifies the
|
|
@@ -177,6 +197,9 @@ module Google
|
|
|
177
197
|
#
|
|
178
198
|
# Format: `documents/{uri_without_scheme}`
|
|
179
199
|
# Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
200
|
+
#
|
|
201
|
+
# Each name must not exceed 500 characters; values longer than 500 characters
|
|
202
|
+
# will result in an `INVALID_ARGUMENT` error.
|
|
180
203
|
# @!attribute [rw] view
|
|
181
204
|
# @return [::Google::Developers::DeveloperKnowledge::V1::DocumentView]
|
|
182
205
|
# Optional. Specifies the
|
|
@@ -199,6 +222,92 @@ module Google
|
|
|
199
222
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
200
223
|
end
|
|
201
224
|
|
|
225
|
+
# Request message for
|
|
226
|
+
# {::Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Client#answer_query DeveloperKnowledge.AnswerQuery}.
|
|
227
|
+
# @!attribute [rw] query
|
|
228
|
+
# @return [::String]
|
|
229
|
+
# Required. The query to answer.
|
|
230
|
+
class AnswerQueryRequest
|
|
231
|
+
include ::Google::Protobuf::MessageExts
|
|
232
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Response message for
|
|
236
|
+
# {::Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Client#answer_query DeveloperKnowledge.AnswerQuery}.
|
|
237
|
+
# @!attribute [rw] answer
|
|
238
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::Answer]
|
|
239
|
+
# The answer to the query.
|
|
240
|
+
class AnswerQueryResponse
|
|
241
|
+
include ::Google::Protobuf::MessageExts
|
|
242
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# An answer to a query.
|
|
246
|
+
# @!attribute [rw] answer_text
|
|
247
|
+
# @return [::String]
|
|
248
|
+
# Contains the text of the answer.
|
|
249
|
+
# @!attribute [r] citations
|
|
250
|
+
# @return [::Array<::Google::Developers::DeveloperKnowledge::V1::Answer::AnswerCitation>]
|
|
251
|
+
# Output only. Contains citations for the answer.
|
|
252
|
+
# @!attribute [r] references
|
|
253
|
+
# @return [::Array<::Google::Developers::DeveloperKnowledge::V1::Answer::AnswerReference>]
|
|
254
|
+
# Output only. Contains references for the answer.
|
|
255
|
+
class Answer
|
|
256
|
+
include ::Google::Protobuf::MessageExts
|
|
257
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
258
|
+
|
|
259
|
+
# Citation info for a segment.
|
|
260
|
+
# @!attribute [r] start_index
|
|
261
|
+
# @return [::Integer]
|
|
262
|
+
# Output only. Indicates the start of the segment, measured in bytes (UTF-8
|
|
263
|
+
# unicode), inclusive. If there are multi-byte characters, such as
|
|
264
|
+
# non-ASCII characters, the index measurement is longer than the string
|
|
265
|
+
# length.
|
|
266
|
+
# @!attribute [r] end_index
|
|
267
|
+
# @return [::Integer]
|
|
268
|
+
# Output only. Indicates the end of the segment, measured in bytes (UTF-8
|
|
269
|
+
# unicode), exclusive. If there are multi-byte characters, such as
|
|
270
|
+
# non-ASCII characters, the index measurement is longer than the string
|
|
271
|
+
# length.
|
|
272
|
+
# @!attribute [r] sources
|
|
273
|
+
# @return [::Array<::Google::Developers::DeveloperKnowledge::V1::Answer::CitationSource>]
|
|
274
|
+
# Output only. Contains citation sources for the attributed segment.
|
|
275
|
+
class AnswerCitation
|
|
276
|
+
include ::Google::Protobuf::MessageExts
|
|
277
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# Citation source.
|
|
281
|
+
# @!attribute [r] reference_index
|
|
282
|
+
# @return [::Integer]
|
|
283
|
+
# Output only. Contains the index of the
|
|
284
|
+
# {::Google::Developers::DeveloperKnowledge::V1::Answer::AnswerReference Answer.AnswerReference}
|
|
285
|
+
# in the `references` repeated field.
|
|
286
|
+
class CitationSource
|
|
287
|
+
include ::Google::Protobuf::MessageExts
|
|
288
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Represents a reference to a source.
|
|
292
|
+
# @!attribute [r] document_reference
|
|
293
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::Answer::DocumentReference]
|
|
294
|
+
# Output only. The reference document.
|
|
295
|
+
class AnswerReference
|
|
296
|
+
include ::Google::Protobuf::MessageExts
|
|
297
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Represents a reference to a document.
|
|
301
|
+
# @!attribute [r] document_chunk
|
|
302
|
+
# @return [::Google::Developers::DeveloperKnowledge::V1::DocumentChunk]
|
|
303
|
+
# Output only. Contains the document chunk. The `document_chunk.id` field
|
|
304
|
+
# is not set and will be empty.
|
|
305
|
+
class DocumentReference
|
|
306
|
+
include ::Google::Protobuf::MessageExts
|
|
307
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
202
311
|
# A DocumentChunk represents a piece of content from a
|
|
203
312
|
# {::Google::Developers::DeveloperKnowledge::V1::Document Document} in the DeveloperKnowledge
|
|
204
313
|
# corpus. To fetch the entire document content, pass the `parent` to
|
|
@@ -248,6 +357,7 @@ module Google
|
|
|
248
357
|
DOCUMENT_VIEW_UNSPECIFIED = 0
|
|
249
358
|
|
|
250
359
|
# Includes only the basic metadata fields:
|
|
360
|
+
#
|
|
251
361
|
# - `name`
|
|
252
362
|
# - `uri`
|
|
253
363
|
# - `data_source`
|
|
@@ -255,6 +365,7 @@ module Google
|
|
|
255
365
|
# - `description`
|
|
256
366
|
# - `update_time`
|
|
257
367
|
# - `view`
|
|
368
|
+
# - `content_length_bytes`
|
|
258
369
|
#
|
|
259
370
|
# This is the default of view for
|
|
260
371
|
# {::Google::Developers::DeveloperKnowledge::V1::DeveloperKnowledge::Client#search_document_chunks DeveloperKnowledge.SearchDocumentChunks}.
|
|
@@ -110,14 +110,15 @@ module Google
|
|
|
110
110
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
|
111
111
|
# @!attribute [rw] seconds
|
|
112
112
|
# @return [::Integer]
|
|
113
|
-
# Represents seconds of UTC time since Unix epoch
|
|
114
|
-
#
|
|
115
|
-
# 9999-12-31T23:59:59Z
|
|
113
|
+
# Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
|
|
114
|
+
# be between -315576000000 and 315576000000 inclusive (which corresponds to
|
|
115
|
+
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
|
|
116
116
|
# @!attribute [rw] nanos
|
|
117
117
|
# @return [::Integer]
|
|
118
|
-
# Non-negative fractions of a second at nanosecond resolution.
|
|
119
|
-
#
|
|
120
|
-
#
|
|
118
|
+
# Non-negative fractions of a second at nanosecond resolution. This field is
|
|
119
|
+
# the nanosecond portion of the duration, not an alternative to seconds.
|
|
120
|
+
# Negative second values with fractions must still have non-negative nanos
|
|
121
|
+
# values that count forward in time. Must be between 0 and 999,999,999
|
|
121
122
|
# inclusive.
|
|
122
123
|
class Timestamp
|
|
123
124
|
include ::Google::Protobuf::MessageExts
|