Skip to content

Commit

Permalink
feat: GenAI - Added response_style to GenerationConfig
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 632268486
  • Loading branch information
Ark-kun authored and copybara-github committed May 9, 2024
1 parent f7c5132 commit cb8b10f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
27 changes: 0 additions & 27 deletions google/cloud/aiplatform_v1beta1/types/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,30 +309,8 @@ class GenerationConfig(proto.Message):
The model needs to be prompted to output the appropriate
response type, otherwise the behavior is undefined. This
is a preview feature.
response_style (google.cloud.aiplatform_v1beta1.types.GenerationConfig.ResponseStyle):
Control Three levels of creativity in the model output.
Default: RESPONSE_STYLE_BALANCED
"""

class ResponseStyle(proto.Enum):
r"""Choices of the response style.
Values:
RESPONSE_STYLE_UNSPECIFIED (0):
response style unspecified.
RESPONSE_STYLE_PRECISE (1):
Precise response.
RESPONSE_STYLE_BALANCED (2):
Default response style.
RESPONSE_STYLE_CREATIVE (3):
Creative response style.
"""
RESPONSE_STYLE_UNSPECIFIED = 0
RESPONSE_STYLE_PRECISE = 1
RESPONSE_STYLE_BALANCED = 2
RESPONSE_STYLE_CREATIVE = 3

temperature: float = proto.Field(
proto.FLOAT,
number=1,
Expand Down Expand Up @@ -376,11 +354,6 @@ class ResponseStyle(proto.Enum):
proto.STRING,
number=13,
)
response_style: ResponseStyle = proto.Field(
proto.ENUM,
number=14,
enum=ResponseStyle,
)


class SafetySetting(proto.Message):
Expand Down
5 changes: 0 additions & 5 deletions vertexai/generative_models/_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,6 @@ class ResponseValidationError(ResponseBlockedError):

class GenerationConfig:
"""Parameters for the generation."""
ResponseStyle = gapic_content_types.GenerationConfig.ResponseStyle

def __init__(
self,
Expand All @@ -1195,7 +1194,6 @@ def __init__(
presence_penalty: Optional[float] = None,
frequency_penalty: Optional[float] = None,
response_mime_type: Optional[str] = None,
response_style: Optional["GenerationConfig.ResponseStyle"] = None,
):
r"""Constructs a GenerationConfig object.
Expand All @@ -1218,7 +1216,6 @@ def __init__(
The model needs to be prompted to output the appropriate
response type, otherwise the behavior is undefined.
response_style: Control three levels of creativity in the model output.
Usage:
```
Expand All @@ -1231,7 +1228,6 @@ def __init__(
candidate_count=1,
max_output_tokens=100,
stop_sequences=["\n\n\n"],
response_style=ResponseStyle.RESPONSE_STYLE_PRECISE,
)
)
```
Expand All @@ -1246,7 +1242,6 @@ def __init__(
presence_penalty=presence_penalty,
frequency_penalty=frequency_penalty,
response_mime_type=response_mime_type,
response_style=response_style,
)

@classmethod
Expand Down

0 comments on commit cb8b10f

Please sign in to comment.