Documentation ¶
Index ¶
- func NewPool(c *Config) sync.Pool
- type Client
- func (c *Client) Acquire() (*fasthttp.Request, *fasthttp.Response)
- func (c *Client) AcquireWithURI(url string) (*fasthttp.Request, *fasthttp.Response)
- func (c *Client) CloseSession(s *pool.Session) bool
- func (c *Client) Release(req *fasthttp.Request, res *fasthttp.Response)
- func (c *Client) Send(sender *Sender) (*pool.Session, error)
- func (c *Client) SetTimeOut(times int)
- type Config
- type MessagesSender
- type Sender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Acquire ¶
Acquire returns an empty fasthttp instance from request pool.
The returned fasthttp instance may be passed to Release when it is no longer needed. This allows Request recycling, reduces GC pressure and usually improves performance.
func (*Client) AcquireWithURI ¶
AcquireWithURI returns an empty fasthttp instance from request pool with a specified url.
The returned fasthttp instance may be passed to Release when it is no longer needed. This allows Request recycling, reduces GC pressure and usually improves performance.
func (*Client) CloseSession ¶
Should only be used when needed.
func (*Client) Release ¶
Release returns req and resp acquired via Acquire to request pool.
It is forbidden accessing req and/or its' members after returning it to request pool.
func (*Client) Send ¶
Send data to the API endpoint. Before sending out, the data will be processed into a form that the API can recognize.
func (*Client) SetTimeOut ¶
Set the response timeout in minutes.
type Config ¶
type Config struct { Key string // API Keys DefaultModel string // Choose the default AI model Compress compress.Interface // Data Compress }
Anthropic-SDK-Go configuration
type MessagesSender ¶
type MessagesSender struct { Message data.MessageArray // Chunked message structure SessionID string // Session ID. If empty, a new session is automatically created. If not empty, an attempt is made to find an existing session. Sender *messages.Sender }
func NewMessagesSender ¶
func NewMessagesSender() *MessagesSender
type Sender ¶
type Sender struct { Message data.MessageModule // Chunked message structure SessionID string // Session ID. If empty, a new session is automatically created. If not empty, an attempt is made to find an existing session. Sender *resp.Sender }