Skip to content

Commit d2004d4

Browse files
docs: [google-ai-generativelanguage] Update summary, improve description for title in EmbedContentRequest (#12219)
BEGIN_COMMIT_OVERRIDE fix!: Fix content.proto's Schema - `type` should be required feat: Update GenAI libraries to include input_safety_feedback docs: Minor docs updates docs: Update summary, improve description for `title` in `EmbedContentRequest` END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 600858110 Source-Link: googleapis/googleapis@50e09cc Source-Link: googleapis/googleapis-gen@f5d8bb9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiZjVkOGJiOTAzMGM3NDEzNzEyMGU2MTgyMjRlNDU5OTM4MWZlZmEzNyJ9 BEGIN_NESTED_COMMIT PiperOrigin-RevId: 600837712 Source-Link: googleapis/googleapis@d99f6f5 Source-Link: googleapis/googleapis-gen@4be94d5 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiNGJlOTRkNTcwNWJkZTEwYzVhOTlhNzU0ZjVhM2E3YmZhMjE1MDllOCJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 82e676d commit d2004d4

16 files changed

Lines changed: 98 additions & 14 deletions

File tree

packages/google-ai-generativelanguage/google/ai/generativelanguage/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.4.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.4.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/types/generative_service.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ class EmbedContentRequest(proto.Message):
442442
Optional. An optional title for the text. Only applicable
443443
when TaskType is ``RETRIEVAL_DOCUMENT``.
444444
445+
Note: Specifying a ``title`` for ``RETRIEVAL_DOCUMENT``
446+
provides better quality embeddings for retrieval.
447+
445448
This field is a member of `oneof`_ ``_title``.
446449
"""
447450

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.4.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/services/generative_service/async_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ async def sample_generate_answer():
426426
the last ``Content`` in the list containing the
427427
question.
428428
429+
Note: GenerateAnswer currently only supports queries in
430+
English.
431+
429432
This corresponds to the ``contents`` field
430433
on the ``request`` instance; if ``request`` is provided, this
431434
should not be set.

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/services/generative_service/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ def sample_generate_answer():
638638
the last ``Content`` in the list containing the
639639
question.
640640
641+
Note: GenerateAnswer currently only supports queries in
642+
English.
643+
641644
This corresponds to the ``contents`` field
642645
on the ``request`` instance; if ``request`` is provided, this
643646
should not be set.

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/types/content.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ class Schema(proto.Message):
339339
340340
Attributes:
341341
type_ (google.ai.generativelanguage_v1beta.types.Type):
342-
Optional. Data type.
342+
Required. Data type.
343343
format_ (str):
344344
Optional. The format of the data. This is
345-
used obnly for primative datatypes. Supported
345+
used only for primitive datatypes. Supported
346346
formats:
347347
348348
for NUMBER type: float, double

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/types/generative_service.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ class GenerateAnswerRequest(proto.Message):
636636
answer. For multi-turn queries, this is a repeated field
637637
that contains conversation history and the last ``Content``
638638
in the list containing the question.
639+
640+
Note: GenerateAnswer currently only supports queries in
641+
English.
639642
answer_style (google.ai.generativelanguage_v1beta.types.GenerateAnswerRequest.AnswerStyle):
640643
Required. Style in which answers should be
641644
returned.
@@ -757,8 +760,72 @@ class GenerateAnswerResponse(proto.Message):
757760
cases. 0.5 is a good starting threshold.
758761
759762
This field is a member of `oneof`_ ``_answerable_probability``.
763+
input_feedback (google.ai.generativelanguage_v1beta.types.GenerateAnswerResponse.InputFeedback):
764+
Output only. Feedback related to the input data used to
765+
answer the question, as opposed to model-generated response
766+
to the question.
767+
768+
"Input data" can be one or more of the following:
769+
770+
- Question specified by the last entry in
771+
``GenerateAnswerRequest.content``
772+
- Conversation history specified by the other entries in
773+
``GenerateAnswerRequest.content``
774+
- Grounding sources
775+
(``GenerateAnswerRequest.semantic_retriever`` or
776+
``GenerateAnswerRequest.inline_passages``)
777+
778+
This field is a member of `oneof`_ ``_input_feedback``.
760779
"""
761780

781+
class InputFeedback(proto.Message):
782+
r"""Feedback related to the input data used to answer the
783+
question, as opposed to model-generated response to the
784+
question.
785+
786+
787+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
788+
789+
Attributes:
790+
block_reason (google.ai.generativelanguage_v1beta.types.GenerateAnswerResponse.InputFeedback.BlockReason):
791+
Optional. If set, the input was blocked and
792+
no candidates are returned. Rephrase your input.
793+
794+
This field is a member of `oneof`_ ``_block_reason``.
795+
safety_ratings (MutableSequence[google.ai.generativelanguage_v1beta.types.SafetyRating]):
796+
Ratings for safety of the input.
797+
There is at most one rating per category.
798+
"""
799+
800+
class BlockReason(proto.Enum):
801+
r"""Specifies what was the reason why input was blocked.
802+
803+
Values:
804+
BLOCK_REASON_UNSPECIFIED (0):
805+
Default value. This value is unused.
806+
SAFETY (1):
807+
Input was blocked due to safety reasons. You can inspect
808+
``safety_ratings`` to understand which safety category
809+
blocked it.
810+
OTHER (2):
811+
Input was blocked due to other reasons.
812+
"""
813+
BLOCK_REASON_UNSPECIFIED = 0
814+
SAFETY = 1
815+
OTHER = 2
816+
817+
block_reason: "GenerateAnswerResponse.InputFeedback.BlockReason" = proto.Field(
818+
proto.ENUM,
819+
number=1,
820+
optional=True,
821+
enum="GenerateAnswerResponse.InputFeedback.BlockReason",
822+
)
823+
safety_ratings: MutableSequence[safety.SafetyRating] = proto.RepeatedField(
824+
proto.MESSAGE,
825+
number=2,
826+
message=safety.SafetyRating,
827+
)
828+
762829
answer: "Candidate" = proto.Field(
763830
proto.MESSAGE,
764831
number=1,
@@ -769,6 +836,12 @@ class GenerateAnswerResponse(proto.Message):
769836
number=2,
770837
optional=True,
771838
)
839+
input_feedback: InputFeedback = proto.Field(
840+
proto.MESSAGE,
841+
number=3,
842+
optional=True,
843+
message=InputFeedback,
844+
)
772845

773846

774847
class EmbedContentRequest(proto.Message):
@@ -797,6 +870,9 @@ class EmbedContentRequest(proto.Message):
797870
Optional. An optional title for the text. Only applicable
798871
when TaskType is ``RETRIEVAL_DOCUMENT``.
799872
873+
Note: Specifying a ``title`` for ``RETRIEVAL_DOCUMENT``
874+
provides better quality embeddings for retrieval.
875+
800876
This field is a member of `oneof`_ ``_title``.
801877
"""
802878

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/types/retriever.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Corpus(proto.Message):
5050
Example: ``corpora/my-awesome-corpora-123a456b789c``
5151
display_name (str):
5252
Optional. The human-readable display name for the
53-
``Corpus``. The display name must be no more than 128
53+
``Corpus``. The display name must be no more than 512
5454
characters in length, including spaces. Example: "Docs on
5555
Semantic Retriever".
5656
create_time (google.protobuf.timestamp_pb2.Timestamp):

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1beta/types/tuned_model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ class Dataset(proto.Message):
333333

334334

335335
class TuningExamples(proto.Message):
336-
r"""A set of tuning examples. Can be training or validatation
337-
data.
336+
r"""A set of tuning examples. Can be training or validation data.
338337
339338
Attributes:
340339
examples (MutableSequence[google.ai.generativelanguage_v1beta.types.TuningExample]):

0 commit comments

Comments
 (0)