Speech2TextGenerator
About 210 wordsLess than 1 minute
2025-10-09
📘 Overview
The Speech2TextGenerator is an operator designed to transcribe speech content into text. It takes a speech file path or URL as input, utilizes a large language model (LLM) for transcription, and saves the resulting text.
__init__
def __init__(
self,
llm_serving: LLMServingABC,
system_prompt: str = "You are a helpful assistant",
):| Parameter | Type | Default Value | Description |
|---|---|---|---|
| llm_serving | LLMServingABC | Required | The large language model serving instance used for transcription. |
| system_prompt | str | "You are a helpful assistant" | The system prompt to define the behavior of the model. |
Prompt Template Descriptions
| Prompt Template Name | Primary Purpose | Applicable Scenarios | Feature Description |
|---|---|---|---|
run
def run(self, storage: DataFlowStorage, input_key: str = "raw_content", output_key: str = "generated_content"):| Parameter | Type | Default Value | Description |
|---|---|---|---|
| storage | DataFlowStorage | Required | The DataFlow storage instance for reading and writing data. |
| input_key | str | "raw_content" | The input column name corresponding to the speech file path or URL. |
| output_key | str | "generated_content" | The output column name for the generated transcription text. |
🧠 Example Usage
# Blank🧾 Default Output Format
| Field | Type | Description |
|---|---|---|
| raw_content | str | The input speech file path or URL. |
| generated_content | str | The transcribed text generated by the model. |
Example Input:
{
"raw_content": "path/to/your/audio.mp3"
}Example Output:
{
"raw_content": "path/to/your/audio.mp3",
"generated_content": "This is the transcribed text from the audio file."
}
