wafruntime

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName = "waf"       // Name of service.
	EndpointsID = ServiceName // ID to lookup a service endpoint with.
	ServiceID   = "waf"       // ServiceID is a unique identifer of a specific service.
)

Service information constants

Variables

This section is empty.

Functions

This section is empty.

Types

type LLMStreamSession added in v1.1.7

type LLMStreamSession struct {
	// 流缓冲区,用于存储流数据
	StreamBuf string
	// 流发送的长度
	StreamSendLen int
	// 消息的唯一标识符
	MsgID string
	// 存储默认响应体
	DefaultBody *waf.CheckLLMResponseStreamOutput
}

LLMStreamSession 表示一个流会话的结构体,包含流缓冲区、流发送长度和消息 ID 等信息。

func (*LLMStreamSession) AppendStreamBuf added in v1.1.7

func (s *LLMStreamSession) AppendStreamBuf(str string)

AppendStreamBuf 向流缓冲区追加一个字符串,并更新流发送长度。 如果 defaultBody 不为空,也可以在这里进行相关操作

func (*LLMStreamSession) GetDefaultBody added in v1.1.7

func (s *LLMStreamSession) GetDefaultBody() *waf.CheckLLMResponseStreamOutput

GetDefaultBody 获取默认响应体。

func (*LLMStreamSession) GetMsgID added in v1.1.7

func (s *LLMStreamSession) GetMsgID() string

GetMsgID 获取消息 ID 的值。

func (*LLMStreamSession) GetStreamBuf added in v1.1.7

func (s *LLMStreamSession) GetStreamBuf() string

GetStreamBuf 获取流缓冲区的值。

func (*LLMStreamSession) GetStreamSendLen added in v1.1.7

func (s *LLMStreamSession) GetStreamSendLen() int

GetStreamSendLen 获取流发送长度的值。

func (*LLMStreamSession) SetDefaultBody added in v1.1.7

func (s *LLMStreamSession) SetDefaultBody(defaultBody *waf.CheckLLMResponseStreamOutput)

SetDefaultBody 设置默认响应体。

func (*LLMStreamSession) SetMsgID added in v1.1.7

func (s *LLMStreamSession) SetMsgID(msgID string)

SetMsgID 设置消息 ID 的值。

func (*LLMStreamSession) SetStreamBuf added in v1.1.7

func (s *LLMStreamSession) SetStreamBuf(streamBuf string)

SetStreamBuf 设置流缓冲区的值。

func (*LLMStreamSession) SetStreamSendLen added in v1.1.7

func (s *LLMStreamSession) SetStreamSendLen(streamSendLen int)

SetStreamSendLen 设置流发送长度的值。

func (*LLMStreamSession) String added in v1.1.7

func (s *LLMStreamSession) String() string

String 重写 String 方法,返回对象的字符串表示形式。

type QueryLLMGenerateStreamInput

type QueryLLMGenerateStreamInput struct {

	// MsgID is a required field
	MsgID *string `type:"string" json:",omitempty" required:"true"`

	UseStream *bool `type:"boolean" json:",omitempty"`
	// contains filtered or unexported fields
}

func (QueryLLMGenerateStreamInput) GoString

func (s QueryLLMGenerateStreamInput) GoString() string

GoString returns the string representation

func (*QueryLLMGenerateStreamInput) SetMsgID

SetMsgID sets the MsgID field's value.

func (*QueryLLMGenerateStreamInput) SetUseStream

SetUseStream sets the UseStream field's value.

func (QueryLLMGenerateStreamInput) String

String returns the string representation

func (*QueryLLMGenerateStreamInput) Validate

func (s *QueryLLMGenerateStreamInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type QueryLLMGenerateStreamOutput

type QueryLLMGenerateStreamOutput struct {
	*utils.StreamReader
}

type WAFAPI

type WAFAPI interface {
	QueryLLMGenerateStream(*QueryLLMGenerateStreamInput) (*QueryLLMGenerateStreamOutput, error)
	QueryLLMGenerateStreamWithContext(volcengine.Context, *QueryLLMGenerateStreamInput, ...request.Option) (*QueryLLMGenerateStreamOutput, error)
	QueryLLMGenerateStreamRequest(*QueryLLMGenerateStreamInput) (*request.Request, *QueryLLMGenerateStreamOutput)
}

WAFAPI provides an interface to enable mocking the waf.WAF service client's API operation,

// volcengine sdk func uses an SDK service client to make a request to
// WAF.
func myFunc(svc WAFAPI) bool {
    // Make svc.AddIpGroup request
}

func main() {
    sess := session.New()
    svc := waf.New(sess)

    myFunc(svc)
}

type WAFRuntime

type WAFRuntime struct {
	*waf.WAF
}

WAF provides the API operation methods for making requests to WAF. See this package's package overview docs for details on the service.

WAF methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

New create int can support ssl or region locate set

func (*WAFRuntime) CheckLLMResponseStream added in v1.1.3

func (c *WAFRuntime) CheckLLMResponseStream(input *waf.CheckLLMResponseStreamInput, session *LLMStreamSession) (*waf.CheckLLMResponseStreamOutput, error)

func (*WAFRuntime) CheckLLMResponseStreamRequest added in v1.1.3

func (c *WAFRuntime) CheckLLMResponseStreamRequest(input *waf.CheckLLMResponseStreamInput, session *LLMStreamSession) (req *request.Request, output *waf.CheckLLMResponseStreamOutput)

func (*WAFRuntime) CheckLLMResponseStreamWithContext added in v1.1.3

func (c *WAFRuntime) CheckLLMResponseStreamWithContext(ctx volcengine.Context, input *waf.CheckLLMResponseStreamInput, session *LLMStreamSession, opts ...request.Option) (*waf.CheckLLMResponseStreamOutput, error)

func (*WAFRuntime) QueryLLMGenerateStream

func (c *WAFRuntime) QueryLLMGenerateStream(input *QueryLLMGenerateStreamInput) (*QueryLLMGenerateStreamOutput, error)

QueryLLMGenerateStream API operation for WAF.

Returns volcengineerr.Error for service API and SDK errors. Use runtime type assertions with volcengineerr.Error's Code and Message methods to get detailed information about the error.

See the VOLCENGINE API reference guide for WAF's API operation QueryLLMGenerateStream for usage and error information.

func (*WAFRuntime) QueryLLMGenerateStreamRequest

func (c *WAFRuntime) QueryLLMGenerateStreamRequest(input *QueryLLMGenerateStreamInput) (req *request.Request, output *QueryLLMGenerateStreamOutput)

QueryLLMGenerateStreamRequest generates a "volcengine/request.Request" representing the client's request for the QueryLLMGenerateStream operation. The "output" return value will be populated with the QueryLLMGenerateStreamCommon request's response once the request completes successfully.

Use "Send" method on the returned QueryLLMGenerateStreamCommon Request to send the API call to the service. the "output" return value is not valid until after QueryLLMGenerateStreamCommon Send returns without error.

See QueryLLMGenerateStream for more information on using the QueryLLMGenerateStream API call, and error handling.

// Example sending a request using the QueryLLMGenerateStreamRequest method.
req, resp := client.QueryLLMGenerateStreamRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

func (*WAFRuntime) QueryLLMGenerateStreamWithContext

func (c *WAFRuntime) QueryLLMGenerateStreamWithContext(ctx volcengine.Context, input *QueryLLMGenerateStreamInput, opts ...request.Option) (*QueryLLMGenerateStreamOutput, error)

QueryLLMGenerateStreamWithContext is the same as QueryLLMGenerateStream with the addition of the ability to pass a context and additional request options.

See QueryLLMGenerateStream for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. Ifthe context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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