Skip to content

Commit

Permalink
- fix: add lang to youtue transcript
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Nov 7, 2024
1 parent 39e93d3 commit 7e5c3c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/shinkai-tool-youtube-summary/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Config = {
};
type Params = {
url: string;
lang?: string;
};
type Result = { summary: string };

Expand All @@ -18,7 +19,9 @@ export const run: Run<Config, Params, Result> = async (
console.log(`transcripting ${parameters.url}`);

// Get transcription
const transcript = await YoutubeTranscript.fetchTranscript(parameters.url);
const transcript = await YoutubeTranscript.fetchTranscript(parameters.url, {
lang: parameters.lang || 'en',
});

// Send to ollama to build a formatted response
const message: OpenAI.ChatCompletionUserMessageParam = {
Expand Down Expand Up @@ -134,6 +137,13 @@ export const definition: ToolDefinition<typeof run> = {
'The full URL of the YouTube video to transcribe and summarize. Must be a valid and accessible YouTube video link.',
example: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
},
lang: {
type: 'string',
description:
'The language code for the transcript in ISO 639-1 format (e.g. "en" for English). Optional. If not specified, will use the default available transcript.',
example: 'en',
nullable: true,
},
},
required: ['url'],
},
Expand Down

0 comments on commit 7e5c3c7

Please sign in to comment.