Skip to content
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

[breadboard-web] Fix audio board #1457

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[breadboard-web] Fix audio board
  • Loading branch information
paullewis committed Apr 19, 2024
commit b11cf10640cdaf2fd9b89ec54d0d6e0ef07c9e58
4 changes: 2 additions & 2 deletions packages/breadboard-web/public/graphs/audio.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"from": "combineAudioAndPrompt",
"to": "describeAudio",
"out": "parts",
"out": "context",
"in": "context"
},
{
Expand Down Expand Up @@ -57,7 +57,7 @@
"id": "combineAudioAndPrompt",
"type": "runJavascript",
"configuration": {
"code": "const combineAudioAndPrompt = ({audio,prompt})=>{return{parts:[audio,{text:prompt}]}};",
"code": "const combineAudioAndPrompt = ({audio,prompt})=>{return{context:{parts:[audio,{text:prompt}]}}};",
"name": "combineAudioAndPrompt",
"raw": true
}
Expand Down
10 changes: 5 additions & 5 deletions packages/breadboard-web/src/boards/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import { board, code } from "@google-labs/breadboard";
import { gemini } from "@google-labs/gemini-kit";

// A node that appends the prompt to the picture.
// A node that appends the prompt to the audio.
// Note, this one is a bit "in the weeds": it literally formats the Gemini Pro
// API request to include the picture as part of the prompt.
// API request to include the audio as part of the prompt.
const partsMaker = code(({ audio, prompt }) => {
return { parts: [audio, { text: prompt }] };
return { context: { parts: [audio, { text: prompt }] } };
});

export default await board(({ audio, prompt }) => {
Expand All @@ -22,7 +22,7 @@ export default await board(({ audio, prompt }) => {
.examples(
"Describe what you hear in the audio. Please respond in markdown"
);
const { parts } = partsMaker({
const { context } = partsMaker({
$id: "combineAudioAndPrompt",
audio,
prompt,
Expand All @@ -31,7 +31,7 @@ export default await board(({ audio, prompt }) => {
$id: "describeAudio",
model: "gemini-1.5-pro-latest",
text: "unused",
context: parts,
context,
});
return { text: describeAudio.text };
}).serialize({
Expand Down