-
Notifications
You must be signed in to change notification settings - Fork 188
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
feat(drivers-prompt-openai):add audio input/output support to OpenAiChatPromptDriver #1617
base: main
Are you sure you want to change the base?
Conversation
0ff40f8
to
375628e
Compare
efa0532
to
7c77f8d
Compare
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
5f9394f
to
73e246a
Compare
Still need docs, code is ready for review though. |
73e246a
to
be417c1
Compare
442d68f
to
f26f6b3
Compare
37f793f
to
f023372
Compare
bc9a49c
to
85e5497
Compare
@@ -177,6 +180,8 @@ def __process_stream(self, prompt_stack: PromptStack) -> Message: | |||
delta_contents[content.index] = [content] | |||
if isinstance(content, TextDeltaMessageContent): | |||
EventBus.publish_event(TextChunkEvent(token=content.text, index=content.index)) | |||
elif isinstance(content, AudioDeltaMessageContent) and content.data is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be the scenario where data is None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAi sometimes sends chunks with no content. For example, a final chunk that contains the usage.
"modalities": self.modalities, | ||
"audio": self.audio, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these follow the same **(...)
syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They get ignored when using non-audio models. But I can see openai-compatible endpoints throwing a fit. I'll make conditional.
elif ( | ||
isinstance(content, AudioMessageContent) | ||
and message.is_assistant() | ||
and time.time() < content.artifact.meta.get("expires_at", float("inf")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the scenario where there is no expires_at
? are we just assuming no expires_at
== try it anyway and see if its expired or not?
artifact = content.artifact | ||
|
||
# We can't send the audio if it's expired. | ||
if int(time.time()) > artifact.meta.get("expires_at", float("inf")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opposite logic here. wondering if we should just always try to send the transcript if there is no expires_at
. i also probably dont understand when certain fields are set or unset, and if they are allowed to be None or not
griptape/tasks/actions_subtask.py
Outdated
@@ -257,7 +265,7 @@ def __init_from_artifact(self, artifact: TextArtifact | ListArtifact) -> None: | |||
None | |||
""" | |||
# When using native tools, we can assume that a TextArtifact is the LLM providing its final answer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment
85e5497
to
e3a3850
Compare
e3a3850
to
884a7ef
Compare
Describe your changes
Added
AudioArtifact
inputs/outputs inOpenAiChatPromptDriver
.Issue ticket number and link
Closes #1601