api

package
v0.0.0-...-0dbd31a Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel = "gpt-4.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssistantObject

type AssistantObject struct {
	ID string `json:"id"`
}

type Choice

type Choice struct {
	Delta *Delta
}

type Client

type Client struct {
	Token string
}

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, endpoint string, obj any) error

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)

type Data

type Data struct {
	Choices []*Choice
}

type Delta

type Delta struct {
	Content string
}

type Error

type Error struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Param   any    `json:"param"`
	Code    any    `json:"code"`
}

func (*Error) Error

func (a *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error,omitEmpty"`
}

type GenericObject

type GenericObject struct {
	// "list" | "model"
	Object string `json:"object"`
	// TODO: should be any?
	Data    []GenericObject `json:"data"`
	ID      string          `json:"id"`
	Created int64           `json:"created"`
	OwnedBy string          `json:"owned_by"`
}

type ListAssistantsResponse

type ListAssistantsResponse struct {
	Data []AssistantObject `json:"data"`
}

type ListModelsResponse

type ListModelsResponse struct {
	Data []Model `json:"data"`
}

type Message

type Message struct {
	// "system" | "user"
	Role    string `json:"role,omitEmpty"`
	Content string `json:"content,omitEmpty"`
}

type Model

type Model struct {
	ID string `json:"id"`
}

type OpenAPISpec

type OpenAPISpec struct {
	Components struct {
		Schemas struct {
			AssistantSupportedModels struct {
				Enum []string `yaml:"enum"`
			} `yaml:"AssistantSupportedModels"`
		} `yaml:"schemas"`
	} `yaml:"components"`
}

Jump to

Keyboard shortcuts

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