Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GenAI - Added response_style to GenerationConfig #3764

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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