gopenai

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

GopenAI (Go Wrapper to work with OpenAI APIs)

Structuring

|--- gopenapi.go
|--- errors
|       |--- http_errors.go
|       |--- openai_errors.go
|       |--- structs.go
|--- endpoints.go
|--- structs.go
|--- README.md
|--- Dalle2
|
|
|
|
|--- GPT


Documentation

Overview

package gopenai provides a Go client for the OpenAI API.

The OpenAI API is a set of HTTP endpoints that you can use to access GPT-3, Dalle etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SubClient interface{}
	// contains filtered or unexported fields
}

Client is the main struct for the gopenai package

func NewClient

func NewClient() *Client

NewClient creates a new openAI client

func (*Client) Connect

func (c *Client) Connect(apiKey string, organisation string) error

Connect to the OpenAI API

func (*Client) Dalle

func (c *Client) Dalle() *dalle.Dalle

Dalle returns a new dalle client

func (*Client) Do

func (c *Client) Do(data constants.RequestData, i interface{}) *errors.HttpError

func (*Client) ListModels

func (c *Client) ListModels() *ListModels

ListModels returns a list of available models

type ListModels

type ListModels struct {
	Data []struct {
		Id         string        `json:"id"`
		Object     string        `json:"object"`
		OwnedBy    string        `json:"owned_by"`
		Permission []interface{} `json:"permission"`
	} `json:"data"`
	Object string `json:"object"`
}

ListModels is a struct that contains the list of models available to the user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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