Documentation
¶
Index ¶
- Constants
- type ChatHistory
- type Client
- func (c *Client) CallHasab(url string, target any) error
- func (c *Client) HasabHistory() (*HasabResponse, error)
- func (c *Client) HasabSpeakers() (*HasabSpeakersResponse, error)
- func (c *Client) HasabTranscriptionHistory() (*HasabTranscriptionResponse, error)
- func (c *Client) HasabTranslationsHistory() (*HasabTranslationsResponse, error)
- func (c *Client) TTSAnalytics() (*TTSAnalyticsResponse, error)
- func (c *Client) TTSHistory() (*TTSHistoryResponse, error)
- func (c *Client) TTSRecord(recordID int) (*TTSRecordResponse, error)
- func (c *Client) TranscribeAudio(filePath, sourceLanguage string) (*UploadAudioResponse, error)
- func (c *Client) TranslateAudio(filePath, sourceLanguage, targetLanguage string) (*UploadAudioResponse, error)
- func (c *Client) UploadAudio(filePath string, transcribe, translate bool, ...) (*UploadAudioResponse, error)
- type HasabAI
- type HasabResponse
- type HasabSpeakersResponse
- type HasabTranscriptionResponse
- type HasabTranslationsResponse
- type Message
- type TTSAnalyticsResponse
- type TTSHistoryResponse
- type TTSRecordResponse
- type UploadAudioResponse
- type User
Constants ¶
View Source
const ( HasabHistoryV1URL = "https://hasab.co/api/v1/chat/history" HasabTranscriptionHistoryV1URL = "https://hasab.co/api/v1/audios" HasabTranscriptionV1URL = "https://hasab.co/api/v1/upload-audio" HasabTranslationsHistoryV1URL = "https://hasab.co/api/v1/translations" HasabSpeakersV1URL = "https://hasab.co/api/v1/tts/speakers" TTSHistoryV1URL = "https://hasab.co/api/v1/tts/history" TTSAnalyticsV1URL = "https://hasab.co/api/v1/tts/analytics" TTSRecordV1URL = "https://hasab.co/api/v1/tts/record" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatHistory ¶
type Client ¶
type Client struct {
ApiKey string
}
func (*Client) HasabHistory ¶
func (c *Client) HasabHistory() (*HasabResponse, error)
func (*Client) HasabSpeakers ¶
func (c *Client) HasabSpeakers() (*HasabSpeakersResponse, error)
func (*Client) HasabTranscriptionHistory ¶
func (c *Client) HasabTranscriptionHistory() (*HasabTranscriptionResponse, error)
func (*Client) HasabTranslationsHistory ¶
func (c *Client) HasabTranslationsHistory() (*HasabTranslationsResponse, error)
func (*Client) TTSAnalytics ¶
func (c *Client) TTSAnalytics() (*TTSAnalyticsResponse, error)
func (*Client) TTSHistory ¶
func (c *Client) TTSHistory() (*TTSHistoryResponse, error)
func (*Client) TranscribeAudio ¶
func (c *Client) TranscribeAudio(filePath, sourceLanguage string) (*UploadAudioResponse, error)
helper for transcription only
func (*Client) TranslateAudio ¶
func (c *Client) TranslateAudio(filePath, sourceLanguage, targetLanguage string) (*UploadAudioResponse, error)
helper for transcription + translation
func (*Client) UploadAudio ¶
type HasabAI ¶
type HasabAI interface {
HasabHistory() (*HasabResponse, error)
HasabTranscriptionHistory() (*HasabTranscriptionResponse, error)
HasabTranslationsHistory() (*HasabTranslationsResponse, error)
HasabSpeakers() (*HasabSpeakersResponse, error)
TTSHistory() (*TTSHistoryResponse, error)
TTSAnalytics() (*TTSAnalyticsResponse, error)
TTSRecord() (TTSRecordResponse, error)
}
type HasabResponse ¶
type HasabResponse struct {
History []ChatHistory `json:"history"`
Success bool `json:"success"`
}
type HasabSpeakersResponse ¶
type HasabTranscriptionResponse ¶
type HasabTranscriptionResponse struct {
ID int `json:"id"`
Filename string `json:"filename"`
OriginalFilename string `json:"original_filename"`
MimeType string `json:"mime_type"`
DurationSeconds string `json:"duration_in_seconds"`
Description string `json:"description"`
Success bool `json:"success"`
Transcription string `json:"transcription"`
Translation string `json:"translation"`
Summary string `json:"summary"`
AudioType string `json:"audio_type"`
CreatedAt string `json:"created_at"`
User User `json:"user"`
}
type HasabTranslationsResponse ¶
type HasabTranslationsResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
ChargeMessage string `json:"charge_message"`
RemainingTokens int `json:"remaining_tokens"`
TokensCharged int `json:"tokens_charged"`
Summary string `json:"summary"`
Timestamp []any `json:"timestamp"`
Audio struct {
ID int `json:"id"`
UserID int `json:"user_id"`
Filename string `json:"filename"`
OriginalFilename string `json:"original_filename"`
Path string `json:"path"`
MimeType string `json:"mime_type"`
FileSize string `json:"file_size"`
DurationSeconds int `json:"duration_in_seconds"`
Description string `json:"description"`
IsMeeting bool `json:"is_meeting"`
Summary string `json:"summary"`
Transcription string `json:"transcription"`
Translation string `json:"translation"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
} `json:"audio"`
Metadata struct {
TokensCharged int `json:"tokens_charged"`
RemainingTokens int `json:"remaining_tokens"`
ChargeMessage string `json:"charge_message"`
} `json:"metadata"`
}
type TTSAnalyticsResponse ¶
type TTSAnalyticsResponse struct {
TotalRequests int `json:"total_requests"`
SuccessfulRequests int `json:"successful_requests"`
Success bool `json:"success"`
FailedRequests int `json:"failed_requests"`
TotalTokensUsed int `json:"total_tokens_used"`
AverageTokensPerRequest float64 `json:"average_tokens_per_request"`
LanguageBreakdown map[string]int `json:"language_breakdown"`
DailyUsage []struct {
Date string `json:"date"`
Requests int `json:"requests"`
TokensUsed int `json:"tokens_used"`
} `json:"daily_usage"`
}
type TTSHistoryResponse ¶
type TTSHistoryResponse struct {
Records []struct {
ID int `json:"id"`
Text string `json:"text"`
Language string `json:"language"`
SpeakerName string `json:"speaker_name"`
Status string `json:"status"`
AudioURL string `json:"audio_url"`
TokensUsed int `json:"tokens_used"`
CreatedAt string `json:"created_at"`
} `json:"records"`
Total int `json:"total"`
Limit int `json:"limit"`
Success bool `json:"success"`
Offset int `json:"offset"`
}
type TTSRecordResponse ¶
type TTSRecordResponse struct {
Success bool `json:"success"`
Record struct {
ID int `json:"id"`
Text string `json:"text"`
Language string `json:"language"`
SpeakerName string `json:"speaker_name"`
Status string `json:"status"`
AudioURL string `json:"audio_url"`
TokensUsed int `json:"tokens_used"`
CreatedAt string `json:"created_at"`
} `json:"record"`
}
type UploadAudioResponse ¶
Click to show internal directories.
Click to hide internal directories.