openai

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 3 Imported by: 2

README

github.com/speakeasy-sdks/openai-go-sdk

SDK Installation

go get github.com/speakeasy-sdks/openai-go-sdk

SDK Example Usage

package main

import (
    "log"
    "github.com/speakeasy-sdks/openai-go-sdk"
    "github.com/speakeasy-sdks/openai-go-sdk/pkg/models/shared"
    "github.com/speakeasy-sdks/openai-go-sdk/pkg/models/operations"
)

func main() {
    s := openai.New()
    
    req := operations.CancelFineTuneRequest{
        PathParams: operations.CancelFineTunePathParams{
            FineTuneID: "unde",
        },
    }
    
    res, err := s.OpenAI.CancelFineTune(ctx, req)
    if err != nil {
        log.Fatal(err)
    }

    if res.FineTune != nil {
        // handle response
    }

SDK Available Operations

OpenAI
  • CancelFineTune - Immediately cancel a fine-tune job.

  • CreateAnswer - Answers the specified question using the provided documents and examples.

The endpoint first searches over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for completion.

  • CreateClassification - Classifies the specified query using provided examples.

The endpoint first searches over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the completions endpoint.

Labeled examples can be provided via an uploaded file, or explicitly listed in the request using the examples parameter for quick tests and small scale use cases.

  • CreateCompletion - Creates a completion for the provided prompt and parameters

  • CreateEdit - Creates a new edit for the provided input, instruction, and parameters

  • CreateEmbedding - Creates an embedding vector representing the input text.

  • CreateFile - Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.

  • CreateFineTune - Creates a job that fine-tunes a specified model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Learn more about Fine-tuning

  • CreateImage - Creates an image given a prompt.
  • CreateImageEdit - Creates an edited or extended image given an original image and a prompt.
  • CreateImageVariation - Creates a variation of a given image.
  • CreateModeration - Classifies if text violates OpenAI's Content Policy
  • CreateSearch - The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them.

To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When file is set, the search endpoint searches over all the documents in the given file and returns up to the max_rerank number of documents. These documents will be returned along with their search scores.

The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.

  • DeleteFile - Delete a file.

  • DeleteModel - Delete a fine-tuned model. You must have the Owner role in your organization.

  • DownloadFile - Returns the contents of the specified file

  • ListEngines - Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.

  • ListFiles - Returns a list of files that belong to the user's organization.

  • ListFineTuneEvents - Get fine-grained status updates for a fine-tune job.

  • ListFineTunes - List your organization's fine-tuning jobs

  • ListModels - Lists the currently available models, and provides basic information about each one such as the owner and availability.

  • RetrieveEngine - Retrieves a model instance, providing basic information about it such as the owner and availability.

  • RetrieveFile - Returns information about a specific file.

  • RetrieveFineTune - Gets info about the fine-tune job.

Learn more about Fine-tuning

  • RetrieveModel - Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
SDK Generated by Speakeasy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{
	"https://api.openai.com/v1",
}

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Openai

type Openai struct {
	OpenAI *openAI
	// contains filtered or unexported fields
}

func New

func New(opts ...SDKOption) *Openai

type SDKOption

type SDKOption func(*Openai)

func WithClient

func WithClient(client HTTPClient) SDKOption

func WithServerURL

func WithServerURL(serverURL string, params map[string]string) SDKOption

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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