serverless

package
v1.18.14 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Overview

Package serverless defines serverless handler context

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	// Data incoming data
	Data() []byte
	// Tag incoming tag
	Tag() uint32
	// Metadata incoming metadata
	Metadata(string) (string, bool)
	// Write writes data
	Write(tag uint32, data []byte) error
	// HTTP http interface
	HTTP() HTTP
	// WriteWithTarget writes data to sfn instance with specified target
	WriteWithTarget(tag uint32, data []byte, target string) error
	// ReadLLMArguments reads LLM function arguments
	ReadLLMArguments(args any) error
	// WriteLLMResult writes LLM function result
	WriteLLMResult(result string) error
	// LLMFunctionCall reads LLM function call
	LLMFunctionCall() (*ai.FunctionCall, error)
}

Context sfn handler context

type CronContext added in v1.17.5

type CronContext interface {
	// Write writes data
	Write(tag uint32, data []byte) error
	// HTTP http interface
	HTTP() HTTP
	// WriteWithTarget writes data to sfn instance with specified target
	WriteWithTarget(tag uint32, data []byte, target string) error
}

CronContext sfn corn handler context

type HTTP added in v1.13.1

type HTTP interface {
	Send(req *HTTPRequest) (*HTTPResponse, error)
	Get(url string) (*HTTPResponse, error)
	Post(url string, contentType string, body []byte) (*HTTPResponse, error)
}

HTTP http interface

type HTTPRequest added in v1.13.1

type HTTPRequest struct {
	Method  string            // GET, POST, PUT, DELETE, ...
	URL     string            // https://example.org
	Header  map[string]string // {"Content-Type": "application/json"}
	Timeout int64             // timeout in milliseconds
	Body    []byte            // request body
}

HTTPRequest http request

type HTTPResponse added in v1.13.1

type HTTPResponse struct {
	Status     string            // "200 OK"
	StatusCode int               // 200, 404, ...
	Header     map[string]string // {"Content-Type": "application/json"}
	Body       []byte            // response body
}

HTTPResponse http response

Directories

Path Synopsis
Package guest wasm application programming interface for guest module
Package guest wasm application programming interface for guest module
Package mock provides a mock context for stream function.
Package mock provides a mock context for stream function.

Jump to

Keyboard shortcuts

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