whisperclient

package module
v0.0.0-...-ec18510 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 6 Imported by: 4

README

whisperclient

A simple Go client for interacting with the WhisperAI API.

Overview

whisperclient is a Go package that provides a straightforward way to transcribe audio using the WhisperAI API.

Installation

go get github.com/alesr/whisperclient

Usage

import "github.com/alesr/whisperclient"

// Initialize the client
client := whisperclient.New(httpClient, apiKey, model)

// Transcribe audio
input := whisperclient.TranscribeAudioInput{
    Name: "sample_audio",
    Language: whisperclient.LanguageEnglish,
    Format: whisperclient.FormatText,
    Data: audioDataReader,
}

response, err := client.TranscribeAudio(context.Background(), input)

Documentation

Index

Constants

View Source
const (
	FormatSrt          string = "srt"
	FormatText         string = "text"
	LanguageEnglish    string = "en"
	LanguagePortuguese string = "pt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a wrapper around the WhisperAI API

func New

func New(httpCli *http.Client, apiKey, model string) *Client

New returns a new Client

func (*Client) TranscribeAudio

func (c *Client) TranscribeAudio(ctx context.Context, in TranscribeAudioInput) ([]byte, error)

TranscribeAudio transcribes the audio from the given input

type TranscribeAudioInput

type TranscribeAudioInput struct {
	Name     string
	Language string
	Format   string
	Data     io.Reader
}

TranscribeAudioInput is the input for the TranscribeAudio method

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL