openai

package
v1.18.6 Latest Latest
Warning

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

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

Documentation

Overview

Package openai is the OpenAI llm provider

Index

Constants

View Source
const APIEndpoint = "https://api.openai.com/v1/chat/completions"

APIEndpoint is the endpoint for OpenAI

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIProvider

type OpenAIProvider struct {
	// APIKey is the API key for OpenAI
	APIKey string
	// Model is the model for OpenAI
	// eg. "gpt-3.5-turbo-1106", "gpt-4-turbo-preview", "gpt-4-vision-preview", "gpt-4"
	Model string
}

OpenAIProvider is the provider for OpenAI

func NewProvider

func NewProvider(apiKey string, model string) *OpenAIProvider

NewProvider creates a new OpenAIProvider

func (*OpenAIProvider) GetChatCompletions

func (p *OpenAIProvider) GetChatCompletions(userInstruction string, baseSystemMessage string, chainMessage ai.ChainMessage, md metadata.M, withTool bool) (*ai.InvokeResponse, error)

GetChatCompletions get chat completions for ai service

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

Name returns the name of the provider

Jump to

Keyboard shortcuts

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