poe

package
v0.0.0-...-2e5b136 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup()

Types

type Choice

type Choice struct {
	Index        int     `json:"index"`
	Message      Message `json:"message"`
	FinishReason string  `json:"finish_reason"`
}

type Client

type Client struct {
	Token string
	Usage []time.Time
	Lock  bool
}

func GetClient

func GetClient() (*Client, error)

func NewClient

func NewClient(token string) (*Client, error)

func (*Client) Ask

func (c *Client) Ask(messages []Message, model string) (*Message, error)

func (*Client) Release

func (c *Client) Release()

func (*Client) Stream

func (c *Client) Stream(messages []Message, model string) (<-chan string, error)

type CompletionRequest

type CompletionRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"`
}

type CompletionResponse

type CompletionResponse struct {
	ID      string   `json:"id"`
	Object  string   `json:"object"`
	Created int      `json:"created"`
	Choices []Choice `json:"choices"`
	Usage   Usage    `json:"usage"`
}

type CompletionSSEResponse

type CompletionSSEResponse struct {
	Choices []SSEChoice `json:"choices"`
	Created int64       `json:"created"`
	Id      string      `json:"id"`
	Model   string      `json:"model"`
	Object  string      `json:"object"`
}

type Delta

type Delta struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
	Name    string `json:"name"`
}

type SSEChoice

type SSEChoice struct {
	Delta        map[string]string `json:"delta"`
	FinishReason *string           `json:"finish_reason"`
	Index        int               `json:"index"`
}

type Usage

type Usage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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