File size: 849 Bytes
988ce90
 
 
 
 
57e16da
39b5447
57e16da
988ce90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57e16da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { getInference } from "$lib/agents/getInference";
import type {
  TextToSpeechArgs,
  TextToSpeechOutput,
} from "@huggingface/inference";

import type { Tool } from "$lib/types";

export const textToSpeechTool: Tool<
  TextToSpeechArgs["inputs"],
  TextToSpeechOutput
> = {
  name: "textToSpeech",
  description: "This tool takes a text input and turns it into an audio file.",
  examples: [
    {
      prompt: 'Say the following out loud:"Hello world!"',
      command: "textToSpeech('Hello world!')",
    },
    {
      prompt: "Say the content of the string txt out loud",
      command: "textToSpeech(txt)",
    },
  ],
  call: async (input) => {
    return await getInference().textToSpeech(
      {
        inputs: await input,
        model: "espnet/kan-bayashi_ljspeech_vits",
      },
      { wait_for_model: true }
    );
  },
};