Documentation
¶
Overview ¶
elevenlabs implements an API client for ElevenLabs, whose Scribe models transcribe speech. https://elevenlabs.io/docs/api-reference/speech-to-text/convert
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) GetModel(_ context.Context, name string) (llm.Model, error)
- func (c *Client) ListModels(context.Context) ([]llm.Model, error)
- func (*Client) Name() string
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Self() llm.Provider
- func (c *Client) Transcribe(ctx context.Context, model llm.Model, audio llm.Resource, ...) (llm.Transcript, llm.Usage, error)
- func (c *Client) Translate(context.Context, llm.Model, llm.Resource, llm.TranscriberStreamFn, ...llm.Opt) (llm.Transcript, llm.Usage, error)
- func (c *Client) URL() *url.URL
- type Model
- func (m *Model) Aliases() []string
- func (m *Model) Capabilities() llm.ModelCap
- func (m *Model) Created() time.Time
- func (m *Model) Description() string
- func (m *Model) InputTokenLimit() *uint
- func (m *Model) Meta() map[string]json.RawMessage
- func (m *Model) Name() string
- func (m *Model) OutputTokenLimit() *uint
- func (m *Model) Provider() llm.Provider
Constants ¶
const (
// Endpoint is ElevenLabs' API, which is the default endpoint
Endpoint = "https://api.elevenlabs.io/v1"
)
Variables ¶
var PingInterval = 5 * time.Minute
PingInterval is how long the result of pinging the API is kept, before it is pinged again, so that a third-party API isn't pinged too often
Functions ¶
This section is empty.
Types ¶
type Client ¶
func New ¶
New returns a client of ElevenLabs' API, at the endpoint, or ElevenLabs' own when it's empty, with the API key, which it needs
func (*Client) ListModels ¶
ListModels returns the Scribe models, which transcribe speech
func (*Client) Ping ¶
Ping checks the API can be reached, with the API key, by listing its models, and returns an error if it can't. The API is only pinged once every PingInterval: otherwise, the result of the last ping is returned, unless it ended as its caller's context did.
func (*Client) Transcribe ¶
func (c *Client) Transcribe(ctx context.Context, model llm.Model, audio llm.Resource, stream llm.TranscriberStreamFn, opts ...llm.Opt) (llm.Transcript, llm.Usage, error)
Transcribe returns the speech in the audio as text, and its language, which is detected, unless it's set, and its segments, and their speakers, when they're asked for, and the seconds of audio. ElevenLabs doesn't stream a transcript, so the stream function, when it isn't nil, is called once it's transcribed. The request isn't timed out, as audio can take a while, but is cancelled with the context.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is one of ElevenLabs' Scribe models, which transcribe speech
func (*Model) Capabilities ¶
Capabilities returns what the model can do, which is transcribe speech, but not translate it, nor anything else
func (*Model) Description ¶
Description returns what the model is
func (*Model) InputTokenLimit ¶
InputTokenLimit isn't known, as a model transcribes audio
func (*Model) OutputTokenLimit ¶
OutputTokenLimit isn't known, as a model transcribes audio