can

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 10 Imported by: 0

README

can - command line interface to openai

can logo

If you don't know which can I'm referring to; read the book Expeditionary Forces.

OpenAI API-Reference

Quick start

$ go install github.com/gregoryv/can/cmd/can@latest
$ can --help

can demo

Documentation

Overview

Package can provides a system for interacting with api.openai.com/v1

The main purpose of this system is to support a simple command line application (cmd/can). It is Not a generic client for api.openai.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type System

type System struct {
	// contains filtered or unexported fields
}

func NewSystem

func NewSystem() *System

NewSystem returns a system with debug log disabled.

func (*System) Run

func (s *System) Run() error

Run builds and executes the request according to the system settings. The idea is to call Run once. It is Not safe to call in concurrent goroutines.

func (*System) SetAPIKey

func (s *System) SetAPIKey(v string)

SetAPIKey sets the bearer key used in API calls.

func (*System) SetAPIKeyFile

func (s *System) SetAPIKeyFile(v string)

SetAPIKeyFile sets the path to the file containing the API Key. If SetAPIKey is used this has no effect.

func (*System) SetAPIUrl

func (s *System) SetAPIUrl(v *url.URL)

SetAPIUrl use scheme://hostname[:port], e.g. https://api.openai.com

func (*System) SetDebugOutput

func (s *System) SetDebugOutput(v io.Writer)

SetDebugOutput writer, use nil to disable

func (*System) SetInput

func (s *System) SetInput(v string)

SetInput sets the question or instruction.

func (*System) SetSrc

func (s *System) SetSrc(v string)

SetSrc sets the path or text used for /v1/edits input.

func (*System) SetSysContent

func (s *System) SetSysContent(v string)

SetSysContent sets the system role content for /v1/chat/completions.

func (*System) SetUpdateSrc

func (s *System) SetUpdateSrc(v bool)

SetUpdateSrc to control if result from /v1/edits should be written back to the src file. Has no effect if the src is not a file.

Directories

Path Synopsis
cmd
can command
Command can provides access to openai API's from the terminal.
Command can provides access to openai API's from the terminal.

Jump to

Keyboard shortcuts

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