Skip to content

Commit

Permalink
Add prompt as an optional input to transcription params (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll authored Mar 21, 2023
1 parent 03cd225 commit d85e436
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions audio/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ func NewClient(session *openai.Session, model string) *Client {
}

type CreateTranscriptionParams struct {
Model string
Language string
Model string
Language string

Audio io.Reader
AudioFormat string // such as "mp3" or "wav", etc.

Prompt string // optional
// TODO: Add temperature.
}

type CreateTranscriptionResponse struct {
Expand All @@ -59,6 +63,9 @@ func (c *Client) CreateTranscription(ctx context.Context, p *CreateTranscription
if p.Language != "" {
params.Set("language", p.Language)
}
if p.Prompt != "" {
params.Set("prompt", p.Prompt)
}
var r CreateTranscriptionResponse
return &r, c.s.Upload(ctx, c.CreateTranscriptionEndpoint, p.Audio, p.AudioFormat, params, &r)
}

0 comments on commit d85e436

Please sign in to comment.