Skip to content

Add fine-grained resource GenerativeSettings to DialogflowCX #14169

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

Conversation

ArtoriaRen
Copy link
Contributor

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

`google_dialogflow_cx_generative_settings`

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1508 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1508 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 32
Passed tests: 30
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • dialogflowcx
#### Action taken
Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDialogflowCXGenerativeSettings_dialogflowcxGenerativeSettingsFullExample
  • TestAccDialogflowCXGenerativeSettings_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDialogflowCXGenerativeSettings_dialogflowcxGenerativeSettingsFullExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDialogflowCXGenerativeSettings_update [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1511 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1511 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 32
Passed tests: 31
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • dialogflowcx
#### Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDialogflowCXGenerativeSettings_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccDialogflowCXGenerativeSettings_update [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

We need to set fallback settings because two prompt_templates are automatically created. Otherwise, update test would fail with an `After applying this test step, the plan was not empty` error.
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 32
Passed tests: 31
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • dialogflowcx
#### Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDialogflowCXGenerativeSettings_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDialogflowCXGenerativeSettings_update [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@ArtoriaRen ArtoriaRen marked this pull request as ready for review June 3, 2025 14:36
@github-actions github-actions bot requested a review from NickElliot June 3, 2025 14:37
Copy link

github-actions bot commented Jun 3, 2025

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@NickElliot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between language_code and lang_code

@ArtoriaRen
Copy link
Contributor Author

what is the difference between language_code and lang_code

language_code is a field of GenerativeSettings https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/GenerativeSettings, whereaslang_code is the query parameter of the getGenerativeSettings method.

@github-actions github-actions bot requested a review from NickElliot June 6, 2025 18:32
…esource_dialogflowcx_generative_settings_test.go

Co-authored-by: Nick Elliot <[email protected]>
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 36
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • dialogflowcx
🟢 All tests passed!

View the build log

ArtoriaRen and others added 2 commits June 6, 2025 16:09
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1520 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 146 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 36
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • dialogflowcx
🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 36
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • dialogflowcx
🟢 All tests passed!

View the build log

Copy link

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are langCode and languageCode always the same value? my question is more or less wondering if the "url_param_only" langCode could be replaced by having languageCode as a field be required and also the URL parameter

@github-actions github-actions bot requested a review from NickElliot June 12, 2025 02:24
Copy link

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

langCode and languageCode won't be always the same value. Users can specify an invalid langCode in the Get request, in which case they will receive an error response.

is a langCode invalid if it doesnt match the languageCode? also is languageCode an exported attribute i.e. will the API return a value for the getGenerativeSettings with the field even if a user does not explicitly supply that?

it doesnt necessarily matter that get request doesnt supply the generative settings object, this would just be simplifying the Terraform config. Is there an actual scenario where a user will have a different value for both of these fields that doesn't produce an error?

@ArtoriaRen
Copy link
Contributor Author

ArtoriaRen commented Jun 17, 2025

is a langCode invalid if it doesnt match the languageCode?

Yes. A dialogflow agent can support multiple languages, and each of them is associated with a GenerativeSettings. If langCode isn't one of the supported languages, the response code will be 400. Example https://screenshot.googleplex.com/6Nu5dpDY5rebwqv.

is languageCode an exported attribute i.e. will the API return a value for the getGenerativeSettings with the field even if a user does not explicitly supply that?

No. Example https://screenshot.googleplex.com/AkF6L5xv2LtdgDT

Is there an actual scenario where a user will have a different value for both of these fields that doesn't produce an error?

As long as langCode is one of the supported languages of the agent, the get request won't produce an error. For example, an agent can support two languages ja and en, so we have two GenerativeSettings, one with languageCode=ja and the other with languageCode=en. A get request on https://{endpoint}/v3/{name=projects/*/locations/*/agents/*/generativeSettings?languageCode=en would succeed. Same for the ?languageCode=ja case. A Get request on any other languageCode would return 400.

@github-actions github-actions bot requested a review from NickElliot June 17, 2025 21:35
Copy link

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on what you said and reviewing the documentation, it seems like langCode is the same value as languageCode within a given instance of the fine grained resource, being functionally the Unique Identifier for the fine grained resource.

Could you remove the langCode url parameter and update the self_link of the resource to be ?languageCode={{language_code}}', and set languageCode` as required?

langCode is the same value as languageCode within a given instance of the fine grained resource,
being functionally the Unique Identifier for the fine grained resource.
@github-actions github-actions bot requested a review from NickElliot June 20, 2025 21:48
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1505 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1505 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 145 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 36
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • dialogflowcx
🟢 All tests passed!

View the build log

@ArtoriaRen
Copy link
Contributor Author

based on what you said and reviewing the documentation, it seems like langCode is the same value as languageCode within a given instance of the fine grained resource, being functionally the Unique Identifier for the fine grained resource.

Could you remove the langCode url parameter and update the self_link of the resource to be ?languageCode={{language_code}}', and set languageCode` as required?

Thanks for the suggestion! I've dropped the the langCode url parameter. Could you please take another look? Thank you!

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 1505 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1505 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 352 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 145 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 36
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • dialogflowcx
🟢 All tests passed!

View the build log

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@NickElliot NickElliot added this pull request to the merge queue Jun 24, 2025
Merged via the queue into GoogleCloudPlatform:main with commit 3ae4e9c Jun 24, 2025
27 checks passed
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jun 25, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jun 25, 2025
jingqizz pushed a commit to jingqizz/magic-modules that referenced this pull request Jul 9, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jul 28, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jul 28, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jul 28, 2025
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants