ai

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_ai_proto protoreflect.FileDescriptor

Functions

func NewAiEndpoints

func NewAiEndpoints() []*api.Endpoint

func RegisterAiHandler

func RegisterAiHandler(s server.Server, hdlr AiHandler, opts ...server.HandlerOption) error

Types

type AiService

type AiService interface {
	Complete(ctx context.Context, in *CompleteRequest, opts ...client.CallOption) (*CompleteResponse, error)
	Chat(ctx context.Context, in *ChatRequest, opts ...client.CallOption) (*ChatResponse, error)
	Edit(ctx context.Context, in *EditRequest, opts ...client.CallOption) (*EditResponse, error)
	Moderate(ctx context.Context, in *ModerateRequest, opts ...client.CallOption) (*ModerateResponse, error)
	Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error)
}

func NewAiService

func NewAiService(name string, c client.Client) AiService

type ChatRequest

type ChatRequest struct {

	// the prompt
	Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// the model e.g gpt-3.5-turbo-16k
	Model string `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"`
	// role e.g system or user
	Role string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"`
	// context for the call
	Context []*Context `protobuf:"bytes,4,rep,name=context,proto3" json:"context,omitempty"`
	// contains filtered or unexported fields
}

Make a request to ChatGPT

func (*ChatRequest) Descriptor deprecated

func (*ChatRequest) Descriptor() ([]byte, []int)

Deprecated: Use ChatRequest.ProtoReflect.Descriptor instead.

func (*ChatRequest) GetContext

func (x *ChatRequest) GetContext() []*Context

func (*ChatRequest) GetModel

func (x *ChatRequest) GetModel() string

func (*ChatRequest) GetPrompt

func (x *ChatRequest) GetPrompt() string

func (*ChatRequest) GetRole

func (x *ChatRequest) GetRole() string

func (*ChatRequest) ProtoMessage

func (*ChatRequest) ProtoMessage()

func (*ChatRequest) ProtoReflect

func (x *ChatRequest) ProtoReflect() protoreflect.Message

func (*ChatRequest) Reset

func (x *ChatRequest) Reset()

func (*ChatRequest) String

func (x *ChatRequest) String() string

type ChatResponse

type ChatResponse struct {

	// the response
	Reply string `protobuf:"bytes,1,opt,name=reply,proto3" json:"reply,omitempty"`
	// contains filtered or unexported fields
}

func (*ChatResponse) Descriptor deprecated

func (*ChatResponse) Descriptor() ([]byte, []int)

Deprecated: Use ChatResponse.ProtoReflect.Descriptor instead.

func (*ChatResponse) GetReply

func (x *ChatResponse) GetReply() string

func (*ChatResponse) ProtoMessage

func (*ChatResponse) ProtoMessage()

func (*ChatResponse) ProtoReflect

func (x *ChatResponse) ProtoReflect() protoreflect.Message

func (*ChatResponse) Reset

func (x *ChatResponse) Reset()

func (*ChatResponse) String

func (x *ChatResponse) String() string

type CompleteRequest

type CompleteRequest struct {

	// input to pass in
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

Make a request to the AI

func (*CompleteRequest) Descriptor deprecated

func (*CompleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use CompleteRequest.ProtoReflect.Descriptor instead.

func (*CompleteRequest) GetText

func (x *CompleteRequest) GetText() string

func (*CompleteRequest) ProtoMessage

func (*CompleteRequest) ProtoMessage()

func (*CompleteRequest) ProtoReflect

func (x *CompleteRequest) ProtoReflect() protoreflect.Message

func (*CompleteRequest) Reset

func (x *CompleteRequest) Reset()

func (*CompleteRequest) String

func (x *CompleteRequest) String() string

type CompleteResponse

type CompleteResponse struct {

	// text returned
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

Response from the AI

func (*CompleteResponse) Descriptor deprecated

func (*CompleteResponse) Descriptor() ([]byte, []int)

Deprecated: Use CompleteResponse.ProtoReflect.Descriptor instead.

func (*CompleteResponse) GetText

func (x *CompleteResponse) GetText() string

func (*CompleteResponse) ProtoMessage

func (*CompleteResponse) ProtoMessage()

func (*CompleteResponse) ProtoReflect

func (x *CompleteResponse) ProtoReflect() protoreflect.Message

func (*CompleteResponse) Reset

func (x *CompleteResponse) Reset()

func (*CompleteResponse) String

func (x *CompleteResponse) String() string

type Context

type Context struct {

	// prompt used
	Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// response for prompt
	Reply string `protobuf:"bytes,2,opt,name=reply,proto3" json:"reply,omitempty"`
	// contains filtered or unexported fields
}

func (*Context) Descriptor deprecated

func (*Context) Descriptor() ([]byte, []int)

Deprecated: Use Context.ProtoReflect.Descriptor instead.

func (*Context) GetPrompt

func (x *Context) GetPrompt() string

func (*Context) GetReply

func (x *Context) GetReply() string

func (*Context) ProtoMessage

func (*Context) ProtoMessage()

func (*Context) ProtoReflect

func (x *Context) ProtoReflect() protoreflect.Message

func (*Context) Reset

func (x *Context) Reset()

func (*Context) String

func (x *Context) String() string

type EditRequest

type EditRequest struct {

	// text/code to check
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// instruction hint e.g check the grammar
	Instruction string `protobuf:"bytes,2,opt,name=instruction,proto3" json:"instruction,omitempty"`
	// contains filtered or unexported fields
}

Edit or edit prompt/code

func (*EditRequest) Descriptor deprecated

func (*EditRequest) Descriptor() ([]byte, []int)

Deprecated: Use EditRequest.ProtoReflect.Descriptor instead.

func (*EditRequest) GetInstruction

func (x *EditRequest) GetInstruction() string

func (*EditRequest) GetText

func (x *EditRequest) GetText() string

func (*EditRequest) ProtoMessage

func (*EditRequest) ProtoMessage()

func (*EditRequest) ProtoReflect

func (x *EditRequest) ProtoReflect() protoreflect.Message

func (*EditRequest) Reset

func (x *EditRequest) Reset()

func (*EditRequest) String

func (x *EditRequest) String() string

type EditResponse

type EditResponse struct {

	// response output
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

func (*EditResponse) Descriptor deprecated

func (*EditResponse) Descriptor() ([]byte, []int)

Deprecated: Use EditResponse.ProtoReflect.Descriptor instead.

func (*EditResponse) GetText

func (x *EditResponse) GetText() string

func (*EditResponse) ProtoMessage

func (*EditResponse) ProtoMessage()

func (*EditResponse) ProtoReflect

func (x *EditResponse) ProtoReflect() protoreflect.Message

func (*EditResponse) Reset

func (x *EditResponse) Reset()

func (*EditResponse) String

func (x *EditResponse) String() string

type GenerateRequest

type GenerateRequest struct {

	// text description of image
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// number of images to generate (max 10)
	Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// size of image 256x256, 512x512, 1024x1024
	Size string `protobuf:"bytes,3,opt,name=size,proto3" json:"size,omitempty"`
	// contains filtered or unexported fields
}

Generate an image from prompt

func (*GenerateRequest) Descriptor deprecated

func (*GenerateRequest) Descriptor() ([]byte, []int)

Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.

func (*GenerateRequest) GetLimit

func (x *GenerateRequest) GetLimit() int32

func (*GenerateRequest) GetSize

func (x *GenerateRequest) GetSize() string

func (*GenerateRequest) GetText

func (x *GenerateRequest) GetText() string

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) ProtoReflect

func (x *GenerateRequest) ProtoReflect() protoreflect.Message

func (*GenerateRequest) Reset

func (x *GenerateRequest) Reset()

func (*GenerateRequest) String

func (x *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {

	// image urls
	Images []*Image `protobuf:"bytes,1,rep,name=images,proto3" json:"images,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateResponse) Descriptor deprecated

func (*GenerateResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.

func (*GenerateResponse) GetImages

func (x *GenerateResponse) GetImages() []*Image

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) ProtoReflect

func (x *GenerateResponse) ProtoReflect() protoreflect.Message

func (*GenerateResponse) Reset

func (x *GenerateResponse) Reset()

func (*GenerateResponse) String

func (x *GenerateResponse) String() string

type Image

type Image struct {

	// image url
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// base64 encoded
	Base64 string `protobuf:"bytes,2,opt,name=base64,proto3" json:"base64,omitempty"`
	// contains filtered or unexported fields
}

func (*Image) Descriptor deprecated

func (*Image) Descriptor() ([]byte, []int)

Deprecated: Use Image.ProtoReflect.Descriptor instead.

func (*Image) GetBase64

func (x *Image) GetBase64() string

func (*Image) GetUrl

func (x *Image) GetUrl() string

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) ProtoReflect

func (x *Image) ProtoReflect() protoreflect.Message

func (*Image) Reset

func (x *Image) Reset()

func (*Image) String

func (x *Image) String() string

type ModerateRequest

type ModerateRequest struct {

	// text to check
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

Moderate hate speech

func (*ModerateRequest) Descriptor deprecated

func (*ModerateRequest) Descriptor() ([]byte, []int)

Deprecated: Use ModerateRequest.ProtoReflect.Descriptor instead.

func (*ModerateRequest) GetText

func (x *ModerateRequest) GetText() string

func (*ModerateRequest) ProtoMessage

func (*ModerateRequest) ProtoMessage()

func (*ModerateRequest) ProtoReflect

func (x *ModerateRequest) ProtoReflect() protoreflect.Message

func (*ModerateRequest) Reset

func (x *ModerateRequest) Reset()

func (*ModerateRequest) String

func (x *ModerateRequest) String() string

type ModerateResponse

type ModerateResponse struct {

	// whether it was flagged or not
	Flagged bool `protobuf:"varint,1,opt,name=flagged,proto3" json:"flagged,omitempty"`
	// categories tested and identified
	Categories map[string]bool `` /* 162-byte string literal not displayed */
	// related scores
	Scores map[string]float64 `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ModerateResponse) Descriptor deprecated

func (*ModerateResponse) Descriptor() ([]byte, []int)

Deprecated: Use ModerateResponse.ProtoReflect.Descriptor instead.

func (*ModerateResponse) GetCategories

func (x *ModerateResponse) GetCategories() map[string]bool

func (*ModerateResponse) GetFlagged

func (x *ModerateResponse) GetFlagged() bool

func (*ModerateResponse) GetScores

func (x *ModerateResponse) GetScores() map[string]float64

func (*ModerateResponse) ProtoMessage

func (*ModerateResponse) ProtoMessage()

func (*ModerateResponse) ProtoReflect

func (x *ModerateResponse) ProtoReflect() protoreflect.Message

func (*ModerateResponse) Reset

func (x *ModerateResponse) Reset()

func (*ModerateResponse) String

func (x *ModerateResponse) String() string

Jump to

Keyboard shortcuts

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