Skip to content

feat(v3): Add support for generator settings on fulfillment #14054

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

Merged
merged 2 commits into from
Jul 3, 2025
Merged
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
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__ = "1.41.1" # {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__ = "1.41.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class FlowsAsyncClient:
parse_flow_validation_result_path = staticmethod(
FlowsClient.parse_flow_validation_result_path
)
generator_path = staticmethod(FlowsClient.generator_path)
parse_generator_path = staticmethod(FlowsClient.parse_generator_path)
intent_path = staticmethod(FlowsClient.intent_path)
parse_intent_path = staticmethod(FlowsClient.parse_intent_path)
page_path = staticmethod(FlowsClient.page_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,30 @@ def parse_flow_validation_result_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def generator_path(
project: str,
location: str,
agent: str,
generator: str,
) -> str:
"""Returns a fully-qualified generator string."""
return "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}".format(
project=project,
location=location,
agent=agent,
generator=generator,
)

@staticmethod
def parse_generator_path(path: str) -> Dict[str, str]:
"""Parses a generator path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/generators/(?P<generator>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def intent_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class PagesAsyncClient:
parse_entity_type_path = staticmethod(PagesClient.parse_entity_type_path)
flow_path = staticmethod(PagesClient.flow_path)
parse_flow_path = staticmethod(PagesClient.parse_flow_path)
generator_path = staticmethod(PagesClient.generator_path)
parse_generator_path = staticmethod(PagesClient.parse_generator_path)
intent_path = staticmethod(PagesClient.intent_path)
parse_intent_path = staticmethod(PagesClient.parse_intent_path)
page_path = staticmethod(PagesClient.page_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,30 @@ def parse_flow_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def generator_path(
project: str,
location: str,
agent: str,
generator: str,
) -> str:
"""Returns a fully-qualified generator string."""
return "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}".format(
project=project,
location=location,
agent=agent,
generator=generator,
)

@staticmethod
def parse_generator_path(path: str) -> Dict[str, str]:
"""Parses a generator path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/generators/(?P<generator>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def intent_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class SessionsAsyncClient:
parse_entity_type_path = staticmethod(SessionsClient.parse_entity_type_path)
flow_path = staticmethod(SessionsClient.flow_path)
parse_flow_path = staticmethod(SessionsClient.parse_flow_path)
generator_path = staticmethod(SessionsClient.generator_path)
parse_generator_path = staticmethod(SessionsClient.parse_generator_path)
intent_path = staticmethod(SessionsClient.intent_path)
parse_intent_path = staticmethod(SessionsClient.parse_intent_path)
page_path = staticmethod(SessionsClient.page_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,30 @@ def parse_flow_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def generator_path(
project: str,
location: str,
agent: str,
generator: str,
) -> str:
"""Returns a fully-qualified generator string."""
return "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}".format(
project=project,
location=location,
agent=agent,
generator=generator,
)

@staticmethod
def parse_generator_path(path: str) -> Dict[str, str]:
"""Parses a generator path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/generators/(?P<generator>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def intent_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class TestCasesAsyncClient:
parse_environment_path = staticmethod(TestCasesClient.parse_environment_path)
flow_path = staticmethod(TestCasesClient.flow_path)
parse_flow_path = staticmethod(TestCasesClient.parse_flow_path)
generator_path = staticmethod(TestCasesClient.generator_path)
parse_generator_path = staticmethod(TestCasesClient.parse_generator_path)
intent_path = staticmethod(TestCasesClient.intent_path)
parse_intent_path = staticmethod(TestCasesClient.parse_intent_path)
page_path = staticmethod(TestCasesClient.page_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,30 @@ def parse_flow_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def generator_path(
project: str,
location: str,
agent: str,
generator: str,
) -> str:
"""Returns a fully-qualified generator string."""
return "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}".format(
project=project,
location=location,
agent=agent,
generator=generator,
)

@staticmethod
def parse_generator_path(path: str) -> Dict[str, str]:
"""Parses a generator path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/generators/(?P<generator>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def intent_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class TransitionRouteGroupsAsyncClient:

flow_path = staticmethod(TransitionRouteGroupsClient.flow_path)
parse_flow_path = staticmethod(TransitionRouteGroupsClient.parse_flow_path)
generator_path = staticmethod(TransitionRouteGroupsClient.generator_path)
parse_generator_path = staticmethod(
TransitionRouteGroupsClient.parse_generator_path
)
intent_path = staticmethod(TransitionRouteGroupsClient.intent_path)
parse_intent_path = staticmethod(TransitionRouteGroupsClient.parse_intent_path)
page_path = staticmethod(TransitionRouteGroupsClient.page_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,30 @@ def parse_flow_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def generator_path(
project: str,
location: str,
agent: str,
generator: str,
) -> str:
"""Returns a fully-qualified generator string."""
return "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}".format(
project=project,
location=location,
agent=agent,
generator=generator,
)

@staticmethod
def parse_generator_path(path: str) -> Dict[str, str]:
"""Parses a generator path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/generators/(?P<generator>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def intent_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class Fulfillment(proto.Message):
in the fulfillment will be respected. This flag is only
useful for fulfillments associated with no-match event
handlers.
generators (MutableSequence[google.cloud.dialogflowcx_v3.types.Fulfillment.GeneratorSettings]):
A list of Generators to be called during this
fulfillment.
"""

class SetParameterAction(proto.Message):
Expand Down Expand Up @@ -206,6 +209,46 @@ class CaseContent(proto.Message):
message="Fulfillment.ConditionalCases.Case",
)

class GeneratorSettings(proto.Message):
r"""Generator settings used by the LLM to generate a text
response.

Attributes:
generator (str):
Required. The generator to call. Format:
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>``.
input_parameters (MutableMapping[str, str]):
Map from [placeholder parameter][Generator.Parameter.id] in
the [Generator][google.cloud.dialogflow.cx.v3.Generator] to
corresponding session parameters. By default, Dialogflow
uses the session parameter with the same name to fill in the
generator template. e.g. If there is a placeholder parameter
``city`` in the Generator, Dialogflow default to fill in the
``$city`` with ``$session.params.city``. However, you may
choose to fill ``$city`` with
``$session.params.desination-city``.

- Map key: [parameter ID][Genrator.Parameter.id]
- Map value: session parameter name
output_parameter (str):
Required. Output parameter which should
contain the generator response.
"""

generator: str = proto.Field(
proto.STRING,
number=1,
)
input_parameters: MutableMapping[str, str] = proto.MapField(
proto.STRING,
proto.STRING,
number=2,
)
output_parameter: str = proto.Field(
proto.STRING,
number=3,
)

messages: MutableSequence[response_message.ResponseMessage] = proto.RepeatedField(
proto.MESSAGE,
number=1,
Expand Down Expand Up @@ -242,6 +285,11 @@ class CaseContent(proto.Message):
proto.BOOL,
number=12,
)
generators: MutableSequence[GeneratorSettings] = proto.RepeatedField(
proto.MESSAGE,
number=13,
message=GeneratorSettings,
)


__all__ = tuple(sorted(__protobuf__.manifest))
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__ = "1.41.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
"version": "1.41.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
"version": "1.41.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Loading
Loading