aliqwen

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ApiBaseUrl = "https://dashscope.aliyuncs.com"
View Source
const ApiVersion = "v1"
View Source
const ChatMessageRoleAssistant = "assistant"
View Source
const ChatMessageRoleSystem = "system"
View Source
const ChatMessageRoleUser = "user"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ApiBaseUrl string
	ApiVersion string
	ApiKey     string
	Model      string
	Params     Parameters
}

func NewClient

func NewClient(key string) *Client

func (*Client) CreateChatCompletion

func (c *Client) CreateChatCompletion(messages []Messages) (*ResponseBody, error)

type Input

type Input struct {
	Messages []Messages `json:"messages"`
}

type Messages

type Messages struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Output

type Output struct {
	Text         string `json:"text"`
	FinishReason string `json:"finish_reason"`
}

type Parameters

type Parameters struct {
	EnableSearch bool `json:"enable_search"`
}

type RequestBody

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

type ResponseBody

type ResponseBody struct {
	Output    Output `json:"output"`
	Usage     Usage  `json:"usage"`
	RequestID string `json:"request_id"`
}

type Usage

type Usage struct {
	OutputTokens int `json:"output_tokens"`
	InputTokens  int `json:"input_tokens"`
}

Jump to

Keyboard shortcuts

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