openai

package
v1.13.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompletionOperation     bindings.OperationKind = "completion"
	ChatCompletionOperation bindings.OperationKind = "chat-completion"
	GetEmbeddingOperation   bindings.OperationKind = "get-embedding"

	APIKey           = "apiKey"
	DeploymentID     = "deploymentID"
	Endpoint         = "endpoint"
	MessagesKey      = "messages"
	Temperature      = "temperature"
	MaxTokens        = "maxTokens"
	TopP             = "topP"
	N                = "n"
	Stop             = "stop"
	FrequencyPenalty = "frequencyPenalty"
	LogitBias        = "logitBias"
	User             = "user"
)

List of operations.

Variables

This section is empty.

Functions

func NewOpenAI

func NewOpenAI(logger logger.Logger) bindings.OutputBinding

NewOpenAI returns a new OpenAI output binding.

Types

type AzOpenAI

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

AzOpenAI represents OpenAI output binding.

func (*AzOpenAI) Close

func (p *AzOpenAI) Close() error

Close Az OpenAI instance.

func (*AzOpenAI) GetComponentMetadata

func (p *AzOpenAI) GetComponentMetadata() (metadataInfo metadata.MetadataMap)

GetComponentMetadata returns the metadata of the component.

func (*AzOpenAI) Init

func (p *AzOpenAI) Init(ctx context.Context, meta bindings.Metadata) error

Init initializes the OpenAI binding.

func (*AzOpenAI) Invoke

func (p *AzOpenAI) Invoke(ctx context.Context, req *bindings.InvokeRequest) (resp *bindings.InvokeResponse, err error)

Invoke handles all invoke operations.

func (*AzOpenAI) Operations

func (p *AzOpenAI) Operations() []bindings.OperationKind

Operations returns list of operations supported by OpenAI binding.

type ChatMessages

type ChatMessages struct {
	DeploymentID     string    `json:"deploymentID"`
	Messages         []Message `json:"messages"`
	Temperature      float32   `json:"temperature"`
	MaxTokens        int32     `json:"maxTokens"`
	TopP             float32   `json:"topP"`
	N                int32     `json:"n"`
	PresencePenalty  float32   `json:"presencePenalty"`
	FrequencyPenalty float32   `json:"frequencyPenalty"`
	Stop             []string  `json:"stop"`
}

ChatMessages type for chat completion API.

type EmbeddingMessage

type EmbeddingMessage struct {
	DeploymentID string `json:"deploymentID"`
	Message      string `json:"message"`
}

type Message

type Message struct {
	Role    string
	Message string
}

Message type stores the messages for bot conversation.

type Prompt

type Prompt struct {
	DeploymentID     string   `json:"deploymentID"`
	Prompt           string   `json:"prompt"`
	Temperature      float32  `json:"temperature"`
	MaxTokens        int32    `json:"maxTokens"`
	TopP             float32  `json:"topP"`
	N                int32    `json:"n"`
	PresencePenalty  float32  `json:"presencePenalty"`
	FrequencyPenalty float32  `json:"frequencyPenalty"`
	Stop             []string `json:"stop"`
}

Prompt type for completion API.

Jump to

Keyboard shortcuts

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