Documentation ¶
Index ¶
- Constants
- type Context
- func (c *Context) Clear()
- func (c *Context) Continue(prompt string) *Context
- func (c *Context) GetContent() string
- func (c *Context) SetBody(opt map[string]any) *Context
- func (c *Context) SetHeader(header *Header) *Context
- func (c *Context) SetMaxTokens(max_tokens int) *Context
- func (c *Context) SetMaxTurns(max_turns int) *Context
- func (c *Context) SetModel(model string) *Context
- func (c *Context) SetOutput(output io.Writer) *Context
- func (c *Context) SetSystemPrompt(prompt string) *Context
- func (c *Context) ToStreamContextWithCannel(ch chan string) *StreamContext
- func (c *Context) ToStreamContextWithWriter() *StreamContext
- type Header
- type StreamContext
- func (c *StreamContext) Continue(prompt string) *StreamContext
- func (c *StreamContext) SetBody(opt map[string]any) *StreamContext
- func (c *StreamContext) SetChannel(ch chan string) *StreamContext
- func (c *StreamContext) SetHeader(header *Header) *StreamContext
- func (c *StreamContext) SetMaxTokens(max_tokens int) *StreamContext
- func (c *StreamContext) SetMaxTurns(max_turns int) *StreamContext
- func (c *StreamContext) SetModel(model string) *StreamContext
- func (c *StreamContext) SetOutput(output io.Writer) *StreamContext
- func (c *StreamContext) SetSystemPrompt(prompt string) *StreamContext
Constants ¶
View Source
const ( API2D_URL = "https://openai.api2d.net/v1/chat/completions" API2D_STREAM_URL = "https://stream.api2d.net/v1/chat/completions" OPENAI_URL = "https://api.openai.com/v1/chat/completions" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func NewContextWithWriter ¶ added in v1.1.3
func (*Context) GetContent ¶
func (*Context) SetMaxTokens ¶ added in v1.0.1
func (*Context) SetMaxTurns ¶ added in v1.0.1
func (*Context) SetSystemPrompt ¶
func (*Context) ToStreamContextWithCannel ¶ added in v1.1.3
func (c *Context) ToStreamContextWithCannel(ch chan string) *StreamContext
func (*Context) ToStreamContextWithWriter ¶ added in v1.1.3
func (c *Context) ToStreamContextWithWriter() *StreamContext
type StreamContext ¶ added in v1.1.3
type StreamContext struct { *Context // contains filtered or unexported fields }
func NewStreamContext ¶ added in v1.1.3
func NewStreamContext() *StreamContext
func NewStreamContextWithChannel ¶ added in v1.1.3
func NewStreamContextWithChannel(ch chan string) *StreamContext
func NewStreamContextWithWriter ¶ added in v1.1.3
func NewStreamContextWithWriter(writer io.Writer) *StreamContext
func (*StreamContext) Continue ¶ added in v1.1.3
func (c *StreamContext) Continue(prompt string) *StreamContext
func (*StreamContext) SetBody ¶ added in v1.1.3
func (c *StreamContext) SetBody(opt map[string]any) *StreamContext
func (*StreamContext) SetChannel ¶ added in v1.1.3
func (c *StreamContext) SetChannel(ch chan string) *StreamContext
func (*StreamContext) SetHeader ¶ added in v1.1.3
func (c *StreamContext) SetHeader(header *Header) *StreamContext
func (*StreamContext) SetMaxTokens ¶ added in v1.1.3
func (c *StreamContext) SetMaxTokens(max_tokens int) *StreamContext
func (*StreamContext) SetMaxTurns ¶ added in v1.1.3
func (c *StreamContext) SetMaxTurns(max_turns int) *StreamContext
func (*StreamContext) SetModel ¶ added in v1.1.3
func (c *StreamContext) SetModel(model string) *StreamContext
func (*StreamContext) SetOutput ¶ added in v1.1.3
func (c *StreamContext) SetOutput(output io.Writer) *StreamContext
func (*StreamContext) SetSystemPrompt ¶ added in v1.1.3
func (c *StreamContext) SetSystemPrompt(prompt string) *StreamContext
Click to show internal directories.
Click to hide internal directories.