qwen

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateImage

func GenerateImage(req *ImageRequest) (string, error)

Types

type CheckText2ImageTaskResponse

type CheckText2ImageTaskResponse struct {
	RequestID string     `json:"request_id"`
	Output    TaskOutput `json:"output"`
	Usage     *Usage     `json:"usage,omitempty"`
}

func CheckText2ImageTask

func CheckText2ImageTask(apiKey, taskID string) (CheckText2ImageTaskResponse, error)

type ImageRequest

type ImageRequest struct {
	ApiKey string
	Input  Input
	Params Params
}

type Input

type Input struct {
	Prompt         string `json:"prompt"`
	NegativePrompt string `json:"negative_prompt,omitempty"`
	RefImg         string `json:"ref_img,omitempty"`
}

type Output

type Output struct {
	TaskID     string `json:"task_id"`
	TaskStatus string `json:"task_status"`
}

type Params

type Params struct {
	Style    string  `json:"style,omitempty"`
	Size     string  `json:"size,omitempty"`
	N        int     `json:"n,omitempty"`
	Seed     int     `json:"seed,omitempty"`
	Strength float64 `json:"strength,omitempty"`
	RefMode  string  `json:"ref_mode,omitempty"`
}

type QianWen

type QianWen struct {
	*ai.Client
	// contains filtered or unexported fields
}

func NewQianWen

func NewQianWen(conf llm.Conf) *QianWen

func (*QianWen) ChatStream

func (o *QianWen) ChatStream(ctx context.Context,
	req *llm.ChatCompletionRequest, respChan chan llm.ChatCompletionStreamResponse)

func (*QianWen) GenerateImage

func (*QianWen) GetConf

func (o *QianWen) GetConf() llm.Conf

type Result

type Result struct {
	URL     string `json:"url"`
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type TaskMetrics

type TaskMetrics struct {
	Total     int `json:"TOTAL"`
	Succeeded int `json:"SUCCEEDED"`
	Failed    int `json:"FAILED"`
}

type TaskOutput

type TaskOutput struct {
	TaskID      string      `json:"task_id"`
	TaskStatus  TaskStatus  `json:"task_status"`
	Results     []Result    `json:"results,omitempty"`
	TaskMetrics TaskMetrics `json:"task_metrics"`
	Code        string      `json:"code,omitempty"`
	Message     string      `json:"message,omitempty"`
}

type TaskStatus

type TaskStatus string
const (
	Running   TaskStatus = "RUNNING"
	Succeeded TaskStatus = "SUCCEEDED"
	Failed    TaskStatus = "FAILED"
)

type Text2ImageRequest

type Text2ImageRequest struct {
	Model      string `json:"model"`
	Input      Input  `json:"input"`
	Parameters Params `json:"parameters"`
}

type Text2ImageResponse

type Text2ImageResponse struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	Output    Output `json:"output"`
	RequestId string `json:"request_id"`
}

func SubmitText2ImageTask

func SubmitText2ImageTask(imageRequest *ImageRequest) (*Text2ImageResponse, error)

type Usage

type Usage struct {
	ImageCount int `json:"image_count"`
}

Jump to

Keyboard shortcuts

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