Skip to content

Commit

Permalink
feat: [google-ai-generativelanguage] Add GoogleSearch tool type (#13411)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

BEGIN_COMMIT_OVERRIDE
feat: Add GoogleSearch tool type
feat: Add return type `Schema response` to function declarations
feat: Add id to FunctionCall and FunctionResponse
feat: Add civic_integrity toggle to generation_config
feat: Add response_modalities to generation_config
feat: Add voice_config to generation_config
docs: Update safety filter list to include civic_integrity
feat: Add image_safety block_reason + finish_reason
feat: Add v1alpha
feat: Add BidiGenerateContent + all the necessary protos
feat: Add TuningMultiturnExample
END_COMMIT_OVERRIDE

feat: Add return type `Schema response` to function declarations
feat: Add id to FunctionCall and FunctionResponse
feat: Add civic_integrity toggle to generation_config
feat: Add response_modalities to generation_config
feat: Add voice_config to generation_config
docs: Update safety filter list to include civic_integrity
feat: Add image_safety block_reason + finish_reason


PiperOrigin-RevId: 713080033

Source-Link:
googleapis/googleapis@130b113

Source-Link:
googleapis/googleapis-gen@d3455ba
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiZDM0NTViYWIyN2E1YzdmOGMzOWU1MzQ4MjY0OTQ2OGJhYTAyMWNlMCJ9

BEGIN_NESTED_COMMIT
feat: [google-ai-generativelanguage] Add civic_integrity toggle
docs: Update safety filter list to include civic_integrity
feat: Add image_safety block_reason + finish_reason

PiperOrigin-RevId: 713079488

Source-Link:
googleapis/googleapis@23553a9

Source-Link:
googleapis/googleapis-gen@28d6444
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiMjhkNjQ0NDQyZGM5YmIzZDBkM2Q2ZjFlZTVmM2EwMjJmOGZmMGM5NCJ9
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: [google-ai-generativelanguage] Add v1alpha
feat: Add BidiGenerateContent + all the necessary protos
feat: Add TuningMultiturnExample

PiperOrigin-RevId: 713078684

Source-Link:
googleapis/googleapis@ae0e102

Source-Link:
googleapis/googleapis-gen@970d7ef
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiOTcwZDdlZjhkYTg0NDc0NGYxZGU4ZDUyN2E5NGViZDI1ZGM3NTM4NCJ9
END_NESTED_COMMIT

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 129140e commit 2c1e359
Show file tree
Hide file tree
Showing 279 changed files with 143,967 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CacheService
------------------------------

.. automodule:: google.ai.generativelanguage_v1alpha.services.cache_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1alpha.services.cache_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DiscussService
--------------------------------

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

.. automodule:: google.ai.generativelanguage_v1alpha.services.file_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1alpha.services.file_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GenerativeService
-----------------------------------

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

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

.. automodule:: google.ai.generativelanguage_v1alpha.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_v1alpha.services.permission_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1alpha.services.permission_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PredictionService
-----------------------------------

.. automodule:: google.ai.generativelanguage_v1alpha.services.prediction_service
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RetrieverService
----------------------------------

.. automodule:: google.ai.generativelanguage_v1alpha.services.retriever_service
:members:
:inherited-members:

.. automodule:: google.ai.generativelanguage_v1alpha.services.retriever_service.pagers
:members:
:inherited-members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Services for Google Ai Generativelanguage v1alpha API
=====================================================
.. toctree::
:maxdepth: 2

cache_service
discuss_service
file_service
generative_service
model_service
permission_service
prediction_service
retriever_service
text_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TextService
-----------------------------

.. automodule:: google.ai.generativelanguage_v1alpha.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 v1alpha API
==================================================

.. automodule:: google.ai.generativelanguage_v1alpha.types
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions packages/google-ai-generativelanguage/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ API Reference
generativelanguage_v1/services_
generativelanguage_v1/types_

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

generativelanguage_v1alpha/services_
generativelanguage_v1alpha/types_

API Reference
-------------
.. toctree::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@
GroundingMetadata,
GroundingSupport,
LogprobsResult,
PrebuiltVoiceConfig,
RetrievalMetadata,
SearchEntryPoint,
Segment,
SemanticRetrieverConfig,
SpeechConfig,
TaskType,
VoiceConfig,
)
from google.ai.generativelanguage_v1beta.types.model import Model
from google.ai.generativelanguage_v1beta.types.model_service import (
Expand Down Expand Up @@ -330,10 +333,13 @@
"GroundingMetadata",
"GroundingSupport",
"LogprobsResult",
"PrebuiltVoiceConfig",
"RetrievalMetadata",
"SearchEntryPoint",
"Segment",
"SemanticRetrieverConfig",
"SpeechConfig",
"VoiceConfig",
"TaskType",
"Model",
"CreateTunedModelMetadata",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.6.14" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.6.14" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ async def sample_generate_content():
Required. The name of the ``Model`` to use for
generating the completion.
Format: ``name=models/{model}``.
Format: ``models/{model}``.
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -494,7 +494,7 @@ async def sample_stream_generate_content():
Required. The name of the ``Model`` to use for
generating the completion.
Format: ``name=models/{model}``.
Format: ``models/{model}``.
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def sample_generate_content():
Required. The name of the ``Model`` to use for
generating the completion.
Format: ``name=models/{model}``.
Format: ``models/{model}``.
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -878,7 +878,7 @@ def sample_stream_generate_content():
Required. The name of the ``Model`` to use for
generating the completion.
Format: ``name=models/{model}``.
Format: ``models/{model}``.
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class GenerateContentRequest(proto.Message):
Required. The name of the ``Model`` to use for generating
the completion.
Format: ``name=models/{model}``.
Format: ``models/{model}``.
contents (MutableSequence[google.ai.generativelanguage_v1.types.Content]):
Required. The content of the current conversation with the
model.
Expand All @@ -124,8 +124,8 @@ class GenerateContentRequest(proto.Message):
will use the default safety setting for that category. Harm
categories HARM_CATEGORY_HATE_SPEECH,
HARM_CATEGORY_SEXUALLY_EXPLICIT,
HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT
are supported. Refer to the
HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT,
HARM_CATEGORY_CIVIC_INTEGRITY are supported. Refer to the
`guide <https://ai.google.dev/gemini-api/docs/safety-settings>`__
for detailed information on available safety settings. Also
refer to the `Safety
Expand Down Expand Up @@ -287,6 +287,11 @@ class GenerationConfig(proto.Message):
[Candidate.logprobs_result][google.ai.generativelanguage.v1.Candidate.logprobs_result].
This field is a member of `oneof`_ ``_logprobs``.
enable_enhanced_civic_answers (bool):
Optional. Enables enhanced civic answers. It
may not be available for all models.
This field is a member of `oneof`_ ``_enable_enhanced_civic_answers``.
"""

candidate_count: int = proto.Field(
Expand Down Expand Up @@ -338,6 +343,11 @@ class GenerationConfig(proto.Message):
number=18,
optional=True,
)
enable_enhanced_civic_answers: bool = proto.Field(
proto.BOOL,
number=19,
optional=True,
)


class GenerateContentResponse(proto.Message):
Expand Down Expand Up @@ -397,12 +407,16 @@ class BlockReason(proto.Enum):
included from the terminology blocklist.
PROHIBITED_CONTENT (4):
Prompt was blocked due to prohibited content.
IMAGE_SAFETY (5):
Candidates blocked due to unsafe image
generation content.
"""
BLOCK_REASON_UNSPECIFIED = 0
SAFETY = 1
OTHER = 2
BLOCKLIST = 3
PROHIBITED_CONTENT = 4
IMAGE_SAFETY = 5

block_reason: "GenerateContentResponse.PromptFeedback.BlockReason" = (
proto.Field(
Expand Down Expand Up @@ -548,6 +562,9 @@ class FinishReason(proto.Enum):
MALFORMED_FUNCTION_CALL (10):
The function call generated by the model is
invalid.
IMAGE_SAFETY (11):
Token generation stopped because generated
images contain safety violations.
"""
FINISH_REASON_UNSPECIFIED = 0
STOP = 1
Expand All @@ -560,6 +577,7 @@ class FinishReason(proto.Enum):
PROHIBITED_CONTENT = 8
SPII = 9
MALFORMED_FUNCTION_CALL = 10
IMAGE_SAFETY = 11

index: int = proto.Field(
proto.INT32,
Expand Down
Loading

0 comments on commit 2c1e359

Please sign in to comment.