Skip to content

Commit

Permalink
feat: add google/ai/generativelanguage_v1beta3 (#11670)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

BEGIN_COMMIT_OVERRIDE
feat: add google/ai/generativelanguage_v1beta3 
feat: Add model tuning
feat: Add permissions service
feat: Add BatchEmbedText and CountTextTokens to the text service
END_COMMIT_OVERRIDE

PiperOrigin-RevId: 566721485

Source-Link:
googleapis/googleapis@87083bf

Source-Link:
googleapis/googleapis-gen@455ab57
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiNDU1YWI1NzU2ZGYzYTJhOWNkYWUyNGQwNjFjYTgzMmFiMWJhNWRjYSJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent f108e9b commit 38f2ca3
Show file tree
Hide file tree
Showing 115 changed files with 40,614 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/google-ai-generativelanguage/.flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/google-ai-generativelanguage/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ We support:

Supported versions can be found in our ``noxfile.py`` `config`_.

.. _config: https://github.com/googleapis/google-cloud-python/blob/main/noxfile.py
.. _config: https://github.com/googleapis/google-cloud-python/blob/main/packages/google-ai-generativelanguage/noxfile.py


**********
Expand Down
2 changes: 1 addition & 1 deletion packages/google-ai-generativelanguage/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
27 changes: 14 additions & 13 deletions packages/google-ai-generativelanguage/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,24 @@ In order to use this library, you first need to go through the following steps:
Installation
~~~~~~~~~~~~

Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
create isolated Python environments. The basic problem it addresses is one of
dependencies and versions, and indirectly permissions.
Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
creates isolated Python environments. These isolated environments can have separate
versions of Python packages, which allows you to isolate one project's dependencies
from the dependencies of other projects.

With `virtualenv`_, it's possible to install this library without needing system
With `venv`_, it's possible to install this library without needing system
install permissions, and without clashing with the installed system
dependencies.

.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
.. _`venv`: https://docs.python.org/3/library/venv.html


Code samples and snippets
~~~~~~~~~~~~~~~~~~~~~~~~~

Code samples and snippets live in the `samples/` folder.
Code samples and snippets live in the `samples/`_ folder.

.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-ai-generativelanguage/samples


Supported Python Versions
Expand All @@ -77,21 +80,19 @@ Mac/Linux

.. code-block:: console
pip install virtualenv
virtualenv <your-env>
python3 -m venv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-ai-generativelanguage
pip install google-ai-generativelanguage
Windows
^^^^^^^

.. code-block:: console
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-ai-generativelanguage
py -m venv <your-env>
.\<your-env>\Scripts\activate
pip install google-ai-generativelanguage
Next Steps
~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion packages/google-ai-generativelanguage/docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DiscussService
--------------------------------

.. automodule:: google.ai.generativelanguage_v1beta3.services.discuss_service
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ModelService
------------------------------

.. automodule:: google.ai.generativelanguage_v1beta3.services.model_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1beta3.services.model_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PermissionService
-----------------------------------

.. automodule:: google.ai.generativelanguage_v1beta3.services.permission_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1beta3.services.permission_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Services for Google Ai Generativelanguage v1beta3 API
=====================================================
.. toctree::
:maxdepth: 2

discuss_service
model_service
permission_service
text_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TextService
-----------------------------

.. automodule:: google.ai.generativelanguage_v1beta3.services.text_service
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Types for Google Ai Generativelanguage v1beta3 API
==================================================

.. automodule:: google.ai.generativelanguage_v1beta3.types
:members:
:show-inheritance:
11 changes: 11 additions & 0 deletions packages/google-ai-generativelanguage/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

.. include:: multiprocessing.rst

This package includes clients for multiple versions of Generative Language API.
By default, you will get version ``generativelanguage_v1beta2``.


API Reference
-------------
Expand All @@ -11,6 +14,14 @@ API Reference
generativelanguage_v1beta2/services
generativelanguage_v1beta2/types

API Reference
-------------
.. toctree::
:maxdepth: 2

generativelanguage_v1beta3/services
generativelanguage_v1beta3/types


Changelog
---------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ async def sample_generate_message():
Returns:
google.ai.generativelanguage_v1beta2.types.GenerateMessageResponse:
The response from the model.
This includes candidate messages and
conversation history in the form of
chronologically-ordered messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def sample_generate_message():
Returns:
google.ai.generativelanguage_v1beta2.types.GenerateMessageResponse:
The response from the model.
This includes candidate messages and
conversation history in the form of
chronologically-ordered messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def __call__(
Returns:
~.discuss_service.GenerateMessageResponse:
The response from the model.
This includes candidate messages and
conversation history in the form of
chronologically-ordered messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class GenerateMessageRequest(proto.Message):

class GenerateMessageResponse(proto.Message):
r"""The response from the model.
This includes candidate messages and
conversation history in the form of chronologically-ordered
messages.
Expand Down Expand Up @@ -174,9 +175,11 @@ class Message(proto.Message):
Attributes:
author (str):
Optional. The author of this Message.
This serves as a key for tagging
the content of this Message when it is fed to
the model as text.
The author can be any alphanumeric string.
content (str):
Required. The text content of the structured ``Message``.
Expand Down Expand Up @@ -276,6 +279,7 @@ class MessagePrompt(proto.Message):

class Example(proto.Message):
r"""An input/output example used to instruct the Model.
It demonstrates how the model should respond or format its
response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Model(proto.Message):
- ``chat-bison``
version (str):
Required. The version number of the model.
This represents the major version
display_name (str):
The human-readable name of the model. E.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

class HarmCategory(proto.Enum):
r"""The category of a rating.
These categories cover various kinds of harms that developers
may wish to adjust.
Expand Down Expand Up @@ -117,6 +118,7 @@ class BlockedReason(proto.Enum):

class SafetyFeedback(proto.Message):
r"""Safety feedback for an entire request.
This field is populated if content in the input and/or response
is blocked due to safety settings. SafetyFeedback may not exist
for every HarmCategory. Each SafetyFeedback will return the
Expand Down Expand Up @@ -145,6 +147,7 @@ class SafetyFeedback(proto.Message):

class SafetyRating(proto.Message):
r"""Safety rating for a piece of content.
The safety rating contains the category of harm and the harm
probability level in that category for a piece of content.
Content is classified for safety across a number of harm
Expand All @@ -161,6 +164,7 @@ class SafetyRating(proto.Message):

class HarmProbability(proto.Enum):
r"""The probability that a piece of content is harmful.
The classification system gives the probability of the content
being unsafe. This does not indicate the severity of harm for a
piece of content.
Expand Down Expand Up @@ -198,6 +202,7 @@ class HarmProbability(proto.Enum):

class SafetySetting(proto.Message):
r"""Safety setting, affecting the safety-blocking behavior.
Passing a safety setting for a category changes the allowed
proability that content is blocked.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class GenerateTextResponse(proto.Message):

class TextPrompt(proto.Message):
r"""Text given to the model as a prompt.
The Model will use this TextPrompt to Generate a text
completion.
Expand All @@ -241,6 +242,7 @@ class TextCompletion(proto.Message):
the model.
safety_ratings (MutableSequence[google.ai.generativelanguage_v1beta2.types.SafetyRating]):
Ratings for the safety of a response.
There is at most one rating per category.
citation_metadata (google.ai.generativelanguage_v1beta2.types.CitationMetadata):
Output only. Citation information for model-generated
Expand Down
Loading

0 comments on commit 38f2ca3

Please sign in to comment.