Skip to content

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#469)
Browse files Browse the repository at this point in the history
* chore: update to gapic-generator-python 1.5.0

feat: add support for `google.cloud.<api>.__version__`
PiperOrigin-RevId: 484665853

Source-Link: googleapis/googleapis@8eb249a

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs: Clarify interactive logging TTL behavior

PiperOrigin-RevId: 485069403

Source-Link: googleapis/googleapis@63cd62a

Source-Link: https://github.com/googleapis/googleapis-gen/commit/d4f928e8aa29d03051428f8661827a534de6e1f6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDRmOTI4ZThhYTI5ZDAzMDUxNDI4Zjg2NjE4MjdhNTM0ZGU2ZTFmNiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update version in gapic_version.py

* add .release-please-manifest.json with correct version

* set manifest to true in .github/release-please.yml

* add release-please-config.json

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: new APIs added to reflect updates to the filestore service

- Add ENTERPRISE Tier
- Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot
- Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare
- Add ConnectMode to NetworkConfig (for Private Service Access support)
- New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING)
- Add SuspensionReason (for KMS related suspension)
- Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled

PiperOrigin-RevId: 487492758

Source-Link: googleapis/googleapis@5be5981

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update path to snippet metadata json

* feat: Add files field to finding's list of attributes

PiperOrigin-RevId: 488290111

Source-Link: googleapis/googleapis@7349e1c

Source-Link: https://github.com/googleapis/googleapis-gen/commit/721049d512deebaa96d438aa23e970299d97712b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzIxMDQ5ZDUxMmRlZWJhYTk2ZDQzOGFhMjNlOTcwMjk5ZDk3NzEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs: Clarified Agent Assist max retention is 30 days

PiperOrigin-RevId: 489241089

Source-Link: googleapis/googleapis@e795029

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4380bee60092cd1aaf2be81b6c08bb76f8c12a66
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDM4MGJlZTYwMDkyY2QxYWFmMmJlODFiNmMwOGJiNzZmOGMxMmE2NiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs: Clarified Agent Assist max retention is 30 days

PiperOrigin-RevId: 489494670

Source-Link: googleapis/googleapis@e35c0d3

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4c3848551a76fdf190533292127211a4ad8fee8b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGMzODQ4NTUxYTc2ZmRmMTkwNTMzMjkyMTI3MjExYTRhZDhmZWU4YiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: use templated setup.py and owlbot.py

* chore(python): fix warehouse-package-name for dialogflow/cx v3 and v3beta1

PiperOrigin-RevId: 492185983

Source-Link: googleapis/googleapis@ac614c7

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ce0d078339e501a500a28fdc4836a8dcccbb7e3b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2UwZDA3ODMzOWU1MDFhNTAwYTI4ZmRjNDgzNmE4ZGNjY2JiN2UzYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Dec 15, 2022
1 parent c16781a commit 9f939a6
Show file tree
Hide file tree
Showing 19 changed files with 349 additions and 241 deletions.
13 changes: 6 additions & 7 deletions Dialogflow-CX/detect_intent_disabled_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ def detect_intent_disabled_webhook(

# Prepare request
text_input = session.TextInput(text=text)
query_input = session.QueryInput(
text=text_input,
language_code=language_code
)
query_input = session.QueryInput(text=text_input, language_code=language_code)
query_params = session.QueryParameters(
disable_webhook=True,
disable_webhook=True,
)
request = session.DetectIntentRequest(
session=session_path,
Expand All @@ -80,14 +77,16 @@ def detect_intent_disabled_webhook(
)

response = session_client.detect_intent(request=request)
print(f'Detect Intent Request: {request.query_params.disable_webhook}')
print(f"Detect Intent Request: {request.query_params.disable_webhook}")
response_text = []
for message in response.query_result.response_messages:
if message.text:
curr_response_text = message.text.text
print(f'Agent Response: {curr_response_text}')
print(f"Agent Response: {curr_response_text}")
response_text.append(curr_response_text)
return response_text


# [END dialogflow_cx_detect_intent_with_disabled_webhook]


Expand Down
16 changes: 8 additions & 8 deletions Dialogflow-CX/detect_intent_disabled_webhook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
def test_detect_intent_positive():
response_text_list = detect_intent_disabled_webhook(
PROJECT_ID,
'global',
"global",
AGENT_ID,
'Perfect!',
'en-us',
"Perfect!",
"en-us",
)
for response_text in response_text_list:
assert response_text[0] in [
'You are welcome!',
'It\'s my pleasure.',
'Anytime.',
'Of course.',
'It\'s my pleasure to serve you.',
"You are welcome!",
"It's my pleasure.",
"Anytime.",
"Of course.",
"It's my pleasure to serve you.",
]
23 changes: 11 additions & 12 deletions Dialogflow-CX/detect_intent_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def run_sample():
# event = "YOUR-EVENT"
# language_code = "YOUR-LANGUAGE-CODE"

project_id = 'dialogflow-cx-demo-1-348717'
location = 'global'
agent_id = '8caa6b47-5dd7-4380-b86e-ea4301d565b0'
event = 'sys.no-match-default'
language_code = 'en-us'
project_id = "dialogflow-cx-demo-1-348717"
location = "global"
agent_id = "8caa6b47-5dd7-4380-b86e-ea4301d565b0"
event = "sys.no-match-default"
language_code = "en-us"

detect_intent_with_event_input(
project_id,
Expand Down Expand Up @@ -71,19 +71,18 @@ def detect_intent_with_event_input(

# Construct detect intent request:
event = session.EventInput(event=event)
query_input = session.QueryInput(
event=event,
language_code=language_code
)
query_input = session.QueryInput(event=event, language_code=language_code)
request = session.DetectIntentRequest(
session=session_path,
query_input=query_input,
session=session_path,
query_input=query_input,
)

response = session_client.detect_intent(request=request)
response_text = response.query_result.response_messages[0].text.text[0]
print(f'Response: {response_text}')
print(f"Response: {response_text}")
return response_text


# [END dialogflow_cx_v3_detect_intent_event_input_async]


Expand Down
30 changes: 15 additions & 15 deletions Dialogflow-CX/detect_intent_event_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
def test_detect_intent_positive():
response_text = detect_intent_with_event_input(
PROJECT_ID,
'global',
"global",
AGENT_ID,
'sys.no-match-default',
'en-us',
"sys.no-match-default",
"en-us",
)
assert response_text in [
'Can you say that again?',
'I didn\'t get that. Can you repeat?',
'I didn\'t get that. Can you say it again?',
'I missed that, say that again?',
'I missed what you said. What was that?',
'One more time?',
'Say that one more time?',
'Sorry, can you say that again?',
'Sorry, could you say that again?',
'Sorry, I didn\'t get that. Can you rephrase?',
'Sorry, what was that?',
'What was that?',
"Can you say that again?",
"I didn't get that. Can you repeat?",
"I didn't get that. Can you say it again?",
"I missed that, say that again?",
"I missed what you said. What was that?",
"One more time?",
"Say that one more time?",
"Sorry, can you say that again?",
"Sorry, could you say that again?",
"Sorry, I didn't get that. Can you rephrase?",
"Sorry, what was that?",
"What was that?",
]
29 changes: 13 additions & 16 deletions Dialogflow-CX/detect_intent_synthesize_tts_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ def detect_intent_synthesize_tts_response(
session=session_id,
)
text_input = session.TextInput(text=text)
query_input = session.QueryInput(
text=text_input,
language_code=language_code
)
query_input = session.QueryInput(text=text_input, language_code=language_code)
synthesize_speech_config = audio_config.SynthesizeSpeechConfig(
speaking_rate=1.25,
pitch=10.0,
speaking_rate=1.25,
pitch=10.0,
)
output_audio_config = audio_config.OutputAudioConfig(
synthesize_speech_config=synthesize_speech_config,
audio_encoding=audio_config.OutputAudioEncoding[
audio_encoding],
synthesize_speech_config=synthesize_speech_config,
audio_encoding=audio_config.OutputAudioEncoding[audio_encoding],
)
request = session.DetectIntentRequest(
session=session_path,
Expand All @@ -92,14 +88,15 @@ def detect_intent_synthesize_tts_response(

response = session_client.detect_intent(request=request)
print(
'Speaking Rate: '
f'{response.output_audio_config.synthesize_speech_config.speaking_rate}')
print(
'Pitch: '
f'{response.output_audio_config.synthesize_speech_config.pitch}')
with open(output_file, 'wb') as fout:
"Speaking Rate: "
f"{response.output_audio_config.synthesize_speech_config.speaking_rate}"
)
print("Pitch: " f"{response.output_audio_config.synthesize_speech_config.pitch}")
with open(output_file, "wb") as fout:
fout.write(response.output_audio)
print(f'Audio content written to file: {output_file}')
print(f"Audio content written to file: {output_file}")


# [END dialogflow_cx_v3_detect_intent_synthesize_tts_response_async]


Expand Down
6 changes: 3 additions & 3 deletions Dialogflow-CX/detect_intent_synthesize_tts_response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def test_detect_intent_positive(capsys, tmp_path_factory):

detect_intent_synthesize_tts_response(
PROJECT_ID,
'global',
"global",
AGENT_ID,
"Perfect!",
'OUTPUT_AUDIO_ENCODING_LINEAR_16',
"OUTPUT_AUDIO_ENCODING_LINEAR_16",
"en-us",
output_file,
)
out, _ = capsys.readouterr()
assert f'Audio content written to file: {output_file}' in out
assert f"Audio content written to file: {output_file}" in out
7 changes: 3 additions & 4 deletions Dialogflow-CX/detect_intent_with_intent_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def detect_intent_with_intent_input(
)

intent = session.IntentInput(intent=intent_path)
query_input = session.QueryInput(
intent=intent,
language_code=language_code
)
query_input = session.QueryInput(intent=intent, language_code=language_code)
request = session.DetectIntentRequest(
session=session_path,
query_input=query_input,
Expand All @@ -88,6 +85,8 @@ def detect_intent_with_intent_input(
response_text.append(response_message.text.text)
print(response_message.text.text)
return response_text


# [END dialogflow_cx_v3_detect_intent_with_intent_input_async]


Expand Down
2 changes: 1 addition & 1 deletion Dialogflow-CX/detect_intent_with_intent_input_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
def test_detect_intent_with_intent_input():
response_text = detect_intent_with_intent_input(
PROJECT_ID,
'global',
"global",
AGENT_ID,
INTENT_ID,
"en-us",
Expand Down
10 changes: 4 additions & 6 deletions Dialogflow-CX/detect_intent_with_sentiment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ def detect_intent_with_sentiment_analysis(
)

text_input = session.TextInput(text=text)
query_input = session.QueryInput(
text=text_input,
language_code=language_code
)
query_input = session.QueryInput(text=text_input, language_code=language_code)
query_params = session.QueryParameters(
analyze_query_text_sentiment=True,
analyze_query_text_sentiment=True,
)
request = session.DetectIntentRequest(
session=session_path,
Expand All @@ -81,9 +78,10 @@ def detect_intent_with_sentiment_analysis(

response = session_client.detect_intent(request=request)
score = response.query_result.sentiment_analysis_result.score
print('Sentiment Score: {score}')
print("Sentiment Score: {score}")
return score


# [END dialogflow_cx_v3_detect_intent_sentiment_analysis_async]


Expand Down
4 changes: 2 additions & 2 deletions Dialogflow-CX/detect_intent_with_sentiment_analysis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

@pytest.mark.parametrize(
"text, expected_score_min, expected_score_max",
(['Perfect', .5, 1], ['I am not happy', -1, -.5])
(["Perfect", 0.5, 1], ["I am not happy", -1, -0.5]),
)
def test_detect_intent_positive(text, expected_score_min, expected_score_max):

score = detect_intent_with_sentiment_analysis(
PROJECT_ID,
'global',
"global",
AGENT_ID,
text,
"en-us",
Expand Down
15 changes: 8 additions & 7 deletions Dialogflow-CX/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None:
# format = isort + black
#


@nox.session
def format(session: nox.sessions.Session) -> None:
"""
Expand Down Expand Up @@ -187,7 +188,9 @@ def _session_tests(
session: nox.sessions.Session, post_install: Callable = None
) -> None:
# check for presence of tests
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
"**/test_*.py", recursive=True
)
test_list.extend(glob.glob("**/tests", recursive=True))

if len(test_list) == 0:
Expand All @@ -209,9 +212,7 @@ def _session_tests(

if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
Expand All @@ -224,9 +225,9 @@ def _session_tests(
post_install(session)

if "pytest-parallel" in packages:
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
elif "pytest-xdist" in packages:
concurrent_args.extend(['-n', 'auto'])
concurrent_args.extend(["-n", "auto"])

session.run(
"pytest",
Expand Down Expand Up @@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None:


def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
"""Returns the root folder of the project."""
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
for i in range(10):
Expand Down
14 changes: 8 additions & 6 deletions Dialogflow-CX/streaming_detect_intent_partial_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def run_sample():
location = "YOUR-LOCATION-ID"
agent_id = "YOUR-AGENT-ID"
audio_file_name = "YOUR-AUDIO-FILE-PATH"
encoding = 'AUDIO_ENCODING_LINEAR_16'
encoding = "AUDIO_ENCODING_LINEAR_16"
sample_rate_hertz = 16000
language_code = 'en'
language_code = "en"

streaming_detect_intent_partial_response(
project_id,
Expand Down Expand Up @@ -93,16 +93,16 @@ def request_generator():
break
# The later requests contains audio data.
audio_input = session.AudioInput(audio=chunk, config=config)
query_input = session.QueryInput(audio=audio_input, language_code=language_code)
query_input = session.QueryInput(
audio=audio_input, language_code=language_code
)
yield session.StreamingDetectIntentRequest(
session=session_path,
query_input=query_input,
enable_partial_response=True,
)

responses = session_client.streaming_detect_intent(
requests=request_generator()
)
responses = session_client.streaming_detect_intent(requests=request_generator())

print("=" * 20)
for response in responses:
Expand All @@ -116,6 +116,8 @@ def request_generator():
" ".join(msg.text.text) for msg in response.query_result.response_messages
]
print(f"Response text: {' '.join(response_messages)}\n")


# [END dialogflow_cx_streaming_detect_intent_enable_partial_response]


Expand Down
Loading

0 comments on commit 9f939a6

Please sign in to comment.