broadscope_bailian

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BroadscopeBailianPopEndpoint = "bailian.cn-beijing.aliyuncs.com"
	BroadscopeBailianEndpoint    = "https://bailian.aliyuncs.com"
	DocReferenceTypeSimple       = "simple"
	DocReferenceTypeIndexed      = "indexed"
)

Variables

View Source
var (
	SSEEventData  = []byte("data: ")
	SSEEventError = []byte(`data: {"error":`)
	SSEEventDone  = "[DONE]"
)

Functions

func ToString added in v1.0.2

func ToString(v *string) string

Types

type AccessTokenClient

type AccessTokenClient struct {
	AccessKeyId     string
	AccessKeySecret string
	AgentKey        string
	Endpoint        string
	TokenData       *client.CreateTokenResponseBodyData
}

func (*AccessTokenClient) CreateToken

func (c *AccessTokenClient) CreateToken() (_result *client.CreateTokenResponseBodyData, _err error)

func (*AccessTokenClient) GetToken

func (c *AccessTokenClient) GetToken() (_token string, _err error)

func (AccessTokenClient) GoString

func (c AccessTokenClient) GoString() string

func (AccessTokenClient) String

func (c AccessTokenClient) String() string

type ChatCompletionMessage added in v1.2.0

type ChatCompletionMessage struct {
	Role    string `json:"Role"`
	Content string `json:"Content"`
}

func (ChatCompletionMessage) GoString added in v1.2.0

func (c ChatCompletionMessage) GoString() string

func (ChatCompletionMessage) String added in v1.2.0

func (c ChatCompletionMessage) String() string

type ChatQaMessage

type ChatQaMessage struct {
	User string `json:"User"`
	Bot  string `json:"Bot"`
}

func (ChatQaMessage) GoString

func (c ChatQaMessage) GoString() string

func (ChatQaMessage) String

func (c ChatQaMessage) String() string

type CompletionClient

type CompletionClient struct {
	Token    string
	Endpoint string
	Timeout  time.Duration
}

func (*CompletionClient) CreateCompletion

func (cc *CompletionClient) CreateCompletion(request *CompletionRequest) (_response *CompletionResponse, _err error)

func (*CompletionClient) CreateCompletionRequest

func (cc *CompletionClient) CreateCompletionRequest(request *CompletionRequest, stream bool) (*http.Request, error)

func (*CompletionClient) CreateStreamCompletion

func (cc *CompletionClient) CreateStreamCompletion(request *CompletionRequest) (_response chan *CompletionResponse, _err error)

func (CompletionClient) GoString

func (cc CompletionClient) GoString() string

func (*CompletionClient) ReadStream

func (cc *CompletionClient) ReadStream(response *http.Response) (chan *CompletionResponse, error)

func (CompletionClient) String

func (cc CompletionClient) String() string

type CompletionRequest

type CompletionRequest struct {
	RequestId        string                           `json:"RequestId"`
	AppId            string                           `json:"AppId"`
	Prompt           string                           `json:"Prompt"`
	SessionId        string                           `json:"SessionId,omitempty"`
	TopP             float32                          `json:"TopP,omitempty"`
	Stream           bool                             `json:"Stream,omitempty"`
	HasThoughts      bool                             `json:"HasThoughts,omitempty"`
	BizParams        map[string]interface{}           `json:"BizParams,omitempty"`
	DocReferenceType string                           `json:"DocReferenceType,omitempty"`
	History          []ChatQaMessage                  `json:"History,omitempty"`
	Messages         []ChatCompletionMessage          `json:"Messages,omitempty"`
	Parameters       *CompletionRequestModelParameter `json:"Parameters,omitempty"`
	DocTagIds        []int64                          `json:"DocTagIds,omitempty"`
	DocTagCodes      []string                         `json:"DocTagCodes,omitempty"`
}

func (CompletionRequest) GoString

func (cr CompletionRequest) GoString() string

func (CompletionRequest) String

func (cr CompletionRequest) String() string

type CompletionRequestModelParameter

type CompletionRequestModelParameter struct {
	TopK              int32    `json:"TopK,omitempty"`
	Seed              int32    `json:"Seed,omitempty"`
	UseRawPrompt      bool     `json:"UseRawPrompt,omitempty"`
	Temperature       float32  `json:"Temperature,omitempty"`
	MaxTokens         int32    `json:"MaxTokens,omitempty"`
	ResultFormat      string   `json:"ResultFormat,omitempty"`
	Stop              []string `json:"Stop,omitempty"`
	IncrementalOutput bool     `json:"IncrementalOutput,omitempty"`
}

func (CompletionRequestModelParameter) GoString

func (CompletionRequestModelParameter) String

type CompletionResponse

type CompletionResponse struct {
	Success   bool                    `json:"Success"`
	Code      string                  `json:"Code,omitempty"`
	Message   string                  `json:"Message,omitempty"`
	RequestId string                  `json:"RequestId,omitempty"`
	Data      *CompletionResponseData `json:"Data,omitempty"`
}

func (CompletionResponse) GoString

func (cr CompletionResponse) GoString() string

func (CompletionResponse) String

func (cr CompletionResponse) String() string

type CompletionResponseChoice added in v1.2.0

type CompletionResponseChoice struct {
	FinishReason string                     `json:"FinishReason,omitempty"`
	Message      *CompletionResponseMessage `json:"Message"`
}

func (CompletionResponseChoice) GoString added in v1.2.0

func (rc CompletionResponseChoice) GoString() string

func (CompletionResponseChoice) String added in v1.2.0

func (rc CompletionResponseChoice) String() string

type CompletionResponseData

type CompletionResponseData struct {
	ResponseId    string                               `json:"ResponseId"`
	SessionId     string                               `json:"SessionId,omitempty"`
	Text          string                               `json:"Text,omitempty"`
	Thoughts      []CompletionResponseDataThought      `json:"Thoughts,omitempty"`
	DocReferences []CompletionResponseDataDocReference `json:"DocReferences,omitempty"`
	Usage         []CompletionResponseDataUsage        `json:"Usage,omitempty"`
	Choices       []CompletionResponseChoice           `json:"Choices,omitempty"`
}

func (CompletionResponseData) GoString

func (cd CompletionResponseData) GoString() string

func (CompletionResponseData) String

func (cd CompletionResponseData) String() string

type CompletionResponseDataDocReference

type CompletionResponseDataDocReference struct {
	IndexId string `json:"IndexId,omitempty"`
	Title   string `json:"Title,omitempty"`
	DocId   string `json:"DocId,omitempty"`
	DocName string `json:"DocName,omitempty"`
	DocUrl  string `json:"DocUrl,omitempty"`
	Text    string `json:"Text,omitempty"`
	BizId   string `json:"BizId,omitempty"`
}

func (CompletionResponseDataDocReference) GoString

func (CompletionResponseDataDocReference) String

type CompletionResponseDataThought

type CompletionResponseDataThought struct {
	Thought           string `json:"Thought,omitempty"`
	ActionType        string `json:"ActionType,omitempty"`
	ActionName        string `json:"ActionName,omitempty"`
	Action            string `json:"Action,omitempty"`
	ActionInputStream string `json:"ActionInputStream,omitempty"`
	ActionInput       string `json:"ActionInput,omitempty"`
	Response          string `json:"Response,omitempty"`
	Observation       string `json:"Observation,omitempty"`
}

func (CompletionResponseDataThought) GoString

func (ct CompletionResponseDataThought) GoString() string

func (CompletionResponseDataThought) String

type CompletionResponseDataUsage added in v1.1.0

type CompletionResponseDataUsage struct {
	InputTokens  int32  `json:"InputTokens"`
	OutputTokens int32  `json:"OutputTokens"`
	ModelId      string `json:"ModelId,omitempty"`
}

func (CompletionResponseDataUsage) GoString added in v1.1.0

func (cu CompletionResponseDataUsage) GoString() string

func (CompletionResponseDataUsage) String added in v1.1.0

func (cu CompletionResponseDataUsage) String() string

type CompletionResponseMessage added in v1.2.0

type CompletionResponseMessage struct {
	Role    string `json:"Role"`
	Content string `json:"Content"`
}

func (CompletionResponseMessage) GoString added in v1.2.0

func (cm CompletionResponseMessage) GoString() string

func (CompletionResponseMessage) String added in v1.2.0

func (cm CompletionResponseMessage) String() string

Jump to

Keyboard shortcuts

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