-
Notifications
You must be signed in to change notification settings - Fork 2.9k
add input_details to SpeechHandle #4701
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
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d918c95
add input_mode to SpeechHandle
longcw bc02108
fix test
longcw 4c268bd
clean
longcw f0e9d6b
Merge remote-tracking branch 'origin/main' into longc/speech-input-mode
longcw 76e9ddf
update address
longcw 6fc06b5
fix confirm address
longcw 5098ac5
add input_source
longcw 096b003
Merge remote-tracking branch 'origin/main' into longc/speech-input-mode
longcw 8636bd7
use input source internally
longcw 96e78c3
add _confirmation_required
longcw 0294a6f
rename to input details
longcw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
devin-ai-integration[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,8 @@ | |
| import asyncio | ||
| import contextlib | ||
| from collections.abc import Callable, Generator, Sequence | ||
| from typing import Any | ||
| from dataclasses import dataclass | ||
| from typing import Any, Literal | ||
|
|
||
| from opentelemetry import context as otel_context | ||
|
|
||
|
|
@@ -13,6 +14,14 @@ | |
| INTERRUPTION_TIMEOUT = 5.0 # seconds | ||
|
|
||
|
|
||
| @dataclass | ||
| class InputSource: | ||
|
||
| modality: Literal["text", "audio"] | ||
|
|
||
|
|
||
| DEFAULT_INPUT_SOURCE = InputSource(modality="audio") | ||
|
|
||
|
|
||
| class SpeechHandle: | ||
| SPEECH_PRIORITY_LOW = 0 | ||
| """Priority for messages that should be played after all other messages in the queue""" | ||
|
|
@@ -21,9 +30,12 @@ class SpeechHandle: | |
| SPEECH_PRIORITY_HIGH = 10 | ||
| """Priority for important messages that should be played before others.""" | ||
|
|
||
| def __init__(self, *, speech_id: str, allow_interruptions: bool) -> None: | ||
| def __init__( | ||
| self, *, speech_id: str, allow_interruptions: bool, input_source: InputSource | ||
| ) -> None: | ||
| self._id = speech_id | ||
| self._allow_interruptions = allow_interruptions | ||
| self._input_source = input_source | ||
|
|
||
| self._interrupt_fut = asyncio.Future[None]() | ||
| self._done_fut = asyncio.Future[None]() | ||
|
|
@@ -51,10 +63,14 @@ def _on_done(_: asyncio.Future[None]) -> None: | |
| self._maybe_run_final_output: Any = None # kept private | ||
|
|
||
| @staticmethod | ||
| def create(allow_interruptions: bool = True) -> SpeechHandle: | ||
| def create( | ||
| allow_interruptions: bool = True, | ||
| input_source: InputSource = DEFAULT_INPUT_SOURCE, | ||
| ) -> SpeechHandle: | ||
| return SpeechHandle( | ||
| speech_id=utils.shortuuid("speech_"), | ||
| allow_interruptions=allow_interruptions, | ||
| input_source=input_source, | ||
| ) | ||
|
|
||
| @property | ||
|
|
@@ -65,6 +81,10 @@ def num_steps(self) -> int: | |
| def id(self) -> str: | ||
| return self._id | ||
|
|
||
| @property | ||
| def input_source(self) -> InputSource: | ||
| return self._input_source | ||
|
|
||
| @property | ||
| def _generation_id(self) -> str: | ||
| return f"{self._id}_{self._num_steps}" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.