Documentation
¶
Index ¶
- Constants
- Variables
- func NewQwenMessage[T qwen.IQwenContent](role string, content T) *qwen.Message[T]
- type AudioInput
- type AudioMessage
- type AudioQwenResponse
- type AudioRequest
- type FileInput
- type FileMessage
- type FileQwenResponse
- type FileRequest
- type TextInput
- type TextMessage
- type TextQwenResponse
- type TextRequest
- type TongyiClient
- func (q *TongyiClient) CloseSpeechToTextGeneration() error
- func (q *TongyiClient) CreateAudioCompletion(ctx context.Context, payload *qwen.Request[*qwen.AudioContentList]) (*AudioQwenResponse, error)
- func (q *TongyiClient) CreateCompletion(ctx context.Context, payload *qwen.Request[*qwen.TextContent]) (*TextQwenResponse, error)
- func (q *TongyiClient) CreateEmbedding(ctx context.Context, r *embedding.Request) ([][]float64, int, error)
- func (q *TongyiClient) CreateFileCompletion(ctx context.Context, payload *qwen.Request[*qwen.FileContentList]) (*FileQwenResponse, error)
- func (q *TongyiClient) CreateImageGeneration(ctx context.Context, payload *wanx.ImageSynthesisRequest) ([]*wanx.ImgBlob, error)
- func (q *TongyiClient) CreateSpeechToTextGeneration(ctx context.Context, request *paraformer.Request, reader *bufio.Reader) error
- func (q *TongyiClient) CreateVLCompletion(ctx context.Context, payload *qwen.Request[*qwen.VLContentList]) (*VLQwenResponse, error)
- func (q *TongyiClient) CreateVoiceFileToTextGeneration(ctx context.Context, request *paraformer.AsyncTaskRequest) (*paraformer.VoiceFileResponse, error)
- func (q *TongyiClient) SetUploadCache(uploadCache qwen.UploadCacher) *TongyiClient
- type VLInput
- type VLMessage
- type VLQwenResponse
- type VLRequest
- type WrapMessageError
Constants ¶
View Source
const (
DashscopeTokenEnvName = "DASHSCOPE_API_KEY" //nolint:gosec
)
Variables ¶
Functions ¶
func NewQwenMessage ¶
func NewQwenMessage[T qwen.IQwenContent](role string, content T) *qwen.Message[T]
Types ¶
type AudioInput ¶
type AudioInput = qwen.Input[*qwen.AudioContentList]
type AudioMessage ¶
type AudioMessage = qwen.Message[*qwen.AudioContentList]
type AudioQwenResponse ¶
type AudioQwenResponse = qwen.OutputResponse[*qwen.AudioContentList]
type AudioRequest ¶
type AudioRequest = qwen.Request[*qwen.AudioContentList]
type FileMessage ¶
type FileMessage = qwen.Message[*qwen.FileContentList]
type FileQwenResponse ¶
type FileQwenResponse = qwen.OutputResponse[*qwen.TextContent] // PDF 文件解析返回的是纯文本格式.
type FileRequest ¶
type FileRequest = qwen.Request[*qwen.FileContentList]
type TextMessage ¶
type TextMessage = qwen.Message[*qwen.TextContent]
type TextQwenResponse ¶
type TextQwenResponse = qwen.OutputResponse[*qwen.TextContent]
type TextRequest ¶
type TextRequest = qwen.Request[*qwen.TextContent]
type TongyiClient ¶
type TongyiClient struct { Model string // contains filtered or unexported fields }
func NewTongyiClient ¶
func NewTongyiClient(model string, token string) *TongyiClient
qwen client with default base url (CN).
func NewTongyiClientIntl ¶
func NewTongyiClientIntl(model string, token string) *TongyiClient
qwen client with international base url.
func (*TongyiClient) CloseSpeechToTextGeneration ¶
func (q *TongyiClient) CloseSpeechToTextGeneration() error
func (*TongyiClient) CreateAudioCompletion ¶
func (q *TongyiClient) CreateAudioCompletion(ctx context.Context, payload *qwen.Request[*qwen.AudioContentList]) (*AudioQwenResponse, error)
func (*TongyiClient) CreateCompletion ¶
func (q *TongyiClient) CreateCompletion(ctx context.Context, payload *qwen.Request[*qwen.TextContent]) (*TextQwenResponse, error)
duplicate: CreateCompletion and CreateVLCompletion are the same but with different payload types. maybe this can be change in the future.
nolint:lll
func (*TongyiClient) CreateEmbedding ¶
func (*TongyiClient) CreateFileCompletion ¶
func (q *TongyiClient) CreateFileCompletion(ctx context.Context, payload *qwen.Request[*qwen.FileContentList]) (*FileQwenResponse, error)
used for pdf_extracter plugin.
func (*TongyiClient) CreateImageGeneration ¶
func (q *TongyiClient) CreateImageGeneration(ctx context.Context, payload *wanx.ImageSynthesisRequest) ([]*wanx.ImgBlob, error)
TODO: intergrate wanx.Request into qwen.IQwenContent(or should rename to ITongyiContent)
func (*TongyiClient) CreateSpeechToTextGeneration ¶
func (q *TongyiClient) CreateSpeechToTextGeneration(ctx context.Context, request *paraformer.Request, reader *bufio.Reader) error
realtime sppech to text.
func (*TongyiClient) CreateVLCompletion ¶
func (q *TongyiClient) CreateVLCompletion(ctx context.Context, payload *qwen.Request[*qwen.VLContentList]) (*VLQwenResponse, error)
func (*TongyiClient) CreateVoiceFileToTextGeneration ¶
func (q *TongyiClient) CreateVoiceFileToTextGeneration(ctx context.Context, request *paraformer.AsyncTaskRequest) (*paraformer.VoiceFileResponse, error)
voice file to text.
func (*TongyiClient) SetUploadCache ¶
func (q *TongyiClient) SetUploadCache(uploadCache qwen.UploadCacher) *TongyiClient
setup upload cache for uploading files to prevent duplicate upload.
type VLQwenResponse ¶
type VLQwenResponse = qwen.OutputResponse[*qwen.VLContentList]
type WrapMessageError ¶
func (*WrapMessageError) Error ¶
func (e *WrapMessageError) Error() string
Click to show internal directories.
Click to hide internal directories.