Skip to content

Google Assistant SDK conversation agent#85499

Merged
balloob merged 5 commits into
home-assistant:devfrom
tronikos:google_assistant_sdk_voice
Jan 10, 2023
Merged

Google Assistant SDK conversation agent#85499
balloob merged 5 commits into
home-assistant:devfrom
tronikos:google_assistant_sdk_voice

Conversation

@tronikos
Copy link
Copy Markdown
Member

@tronikos tronikos commented Jan 9, 2023

Proposed change

Implement Google Assistant SDK conversation agent.

Users need to add in the configuration.yaml:

conversation:

and then they can click on the microphone in the up right corner to start a conversation with Google Assistant either by typing or talking to the microphone. Example:

google_assistant_sdk_conversation

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Comment thread homeassistant/components/google_assistant_sdk/__init__.py Outdated
intent_response = intent.IntentResponse(language=language)
intent_response.async_set_speech(text_response)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The way conversation_id is used that when a conversation is initiated, it is set to None.

Then in your response you return a conversation ID such that follow-up responses work.

Now in this case it doesn't seem like you're passing conversation_id so you should set conversation_id=None here, as it's not used.

Suggested change
response=intent_response, conversation_id=conversation_id
response=intent_response, conversation_id=None

Now in your screenshot I did notice that it's allowing follow-up commands, so I am not sure how that works then 🤷

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Both DefaultAgent and AlmondAgent (the only other two agents) do exactly the same thing. conversation_id starts with None and is never modified.

Anyway for Google Assistant we cannot really have many concurrent conversations, see https://github.com/tronikos/gassist_text/blob/main/src/google/assistant/embedded/v1alpha2/embedded_assistant.proto#L314-L318

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah neither can do conversations.

Comment thread homeassistant/components/google_assistant_sdk/config_flow.py
@balloob balloob merged commit e24989b into home-assistant:dev Jan 10, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants