Documentation ¶
Index ¶
- Variables
- func InitClient(conf zrpc.RpcClientConf)
- func RegisterChatGptServiceServer(s grpc.ServiceRegistrar, srv ChatGptServiceServer)
- type AnswerReq
- func (*AnswerReq) Descriptor() ([]byte, []int)deprecated
- func (x *AnswerReq) GetMaxTokens() int32
- func (x *AnswerReq) GetMessages() []*ChatGptMessage
- func (*AnswerReq) ProtoMessage()
- func (x *AnswerReq) ProtoReflect() protoreflect.Message
- func (x *AnswerReq) Reset()
- func (x *AnswerReq) String() string
- type AnswerResp
- func (*AnswerResp) Descriptor() ([]byte, []int)deprecated
- func (x *AnswerResp) GetChoices() []*AnswerResp_Choice
- func (x *AnswerResp) GetErrorInfo() string
- func (*AnswerResp) ProtoMessage()
- func (x *AnswerResp) ProtoReflect() protoreflect.Message
- func (x *AnswerResp) Reset()
- func (x *AnswerResp) String() string
- type AnswerResp_Choice
- func (*AnswerResp_Choice) Descriptor() ([]byte, []int)deprecated
- func (x *AnswerResp_Choice) GetFinishReason() string
- func (x *AnswerResp_Choice) GetIndex() int64
- func (x *AnswerResp_Choice) GetMessage() *ChatGptMessage
- func (*AnswerResp_Choice) ProtoMessage()
- func (x *AnswerResp_Choice) ProtoReflect() protoreflect.Message
- func (x *AnswerResp_Choice) Reset()
- func (x *AnswerResp_Choice) String() string
- type ChatGptMessage
- func (*ChatGptMessage) Descriptor() ([]byte, []int)deprecated
- func (x *ChatGptMessage) GetRole() RoleEnum
- func (x *ChatGptMessage) GetText() string
- func (*ChatGptMessage) ProtoMessage()
- func (x *ChatGptMessage) ProtoReflect() protoreflect.Message
- func (x *ChatGptMessage) Reset()
- func (x *ChatGptMessage) String() string
- type ChatGptServiceClient
- type ChatGptServiceServer
- type RoleEnum
- type UnimplementedChatGptServiceServer
- type UnsafeChatGptServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( RoleEnum_name = map[int32]string{ 0: "System", 1: "Assistant", 2: "User", } RoleEnum_value = map[string]int32{ "System": 0, "Assistant": 1, "User": 2, } )
Enum value maps for RoleEnum.
var ChatGptService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "pb.ChatGptService", HandlerType: (*ChatGptServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Answer", Handler: _ChatGptService_Answer_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "chatgpt.proto", }
ChatGptService_ServiceDesc is the grpc.ServiceDesc for ChatGptService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_chatgpt_proto protoreflect.FileDescriptor
Functions ¶
func InitClient ¶
func InitClient(conf zrpc.RpcClientConf)
func RegisterChatGptServiceServer ¶
func RegisterChatGptServiceServer(s grpc.ServiceRegistrar, srv ChatGptServiceServer)
Types ¶
type AnswerReq ¶
type AnswerReq struct { Messages []*ChatGptMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` MaxTokens int32 `protobuf:"varint,2,opt,name=maxTokens,proto3" json:"maxTokens,omitempty"` // contains filtered or unexported fields }
func (*AnswerReq) Descriptor
deprecated
func (*AnswerReq) GetMaxTokens ¶
func (*AnswerReq) GetMessages ¶
func (x *AnswerReq) GetMessages() []*ChatGptMessage
func (*AnswerReq) ProtoMessage ¶
func (*AnswerReq) ProtoMessage()
func (*AnswerReq) ProtoReflect ¶
func (x *AnswerReq) ProtoReflect() protoreflect.Message
type AnswerResp ¶
type AnswerResp struct { Choices []*AnswerResp_Choice `protobuf:"bytes,1,rep,name=choices,proto3" json:"choices,omitempty"` ErrorInfo string `protobuf:"bytes,2,opt,name=errorInfo,proto3" json:"errorInfo,omitempty"` // contains filtered or unexported fields }
func (*AnswerResp) Descriptor
deprecated
func (*AnswerResp) Descriptor() ([]byte, []int)
Deprecated: Use AnswerResp.ProtoReflect.Descriptor instead.
func (*AnswerResp) GetChoices ¶
func (x *AnswerResp) GetChoices() []*AnswerResp_Choice
func (*AnswerResp) GetErrorInfo ¶
func (x *AnswerResp) GetErrorInfo() string
func (*AnswerResp) ProtoMessage ¶
func (*AnswerResp) ProtoMessage()
func (*AnswerResp) ProtoReflect ¶
func (x *AnswerResp) ProtoReflect() protoreflect.Message
func (*AnswerResp) Reset ¶
func (x *AnswerResp) Reset()
func (*AnswerResp) String ¶
func (x *AnswerResp) String() string
type AnswerResp_Choice ¶
type AnswerResp_Choice struct { Message *ChatGptMessage `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` FinishReason string `protobuf:"bytes,2,opt,name=finishReason,proto3" json:"finishReason,omitempty"` Index int64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` // contains filtered or unexported fields }
func (*AnswerResp_Choice) Descriptor
deprecated
func (*AnswerResp_Choice) Descriptor() ([]byte, []int)
Deprecated: Use AnswerResp_Choice.ProtoReflect.Descriptor instead.
func (*AnswerResp_Choice) GetFinishReason ¶
func (x *AnswerResp_Choice) GetFinishReason() string
func (*AnswerResp_Choice) GetIndex ¶
func (x *AnswerResp_Choice) GetIndex() int64
func (*AnswerResp_Choice) GetMessage ¶
func (x *AnswerResp_Choice) GetMessage() *ChatGptMessage
func (*AnswerResp_Choice) ProtoMessage ¶
func (*AnswerResp_Choice) ProtoMessage()
func (*AnswerResp_Choice) ProtoReflect ¶
func (x *AnswerResp_Choice) ProtoReflect() protoreflect.Message
func (*AnswerResp_Choice) Reset ¶
func (x *AnswerResp_Choice) Reset()
func (*AnswerResp_Choice) String ¶
func (x *AnswerResp_Choice) String() string
type ChatGptMessage ¶
type ChatGptMessage struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` Role RoleEnum `protobuf:"varint,2,opt,name=role,proto3,enum=pb.RoleEnum" json:"role,omitempty"` // contains filtered or unexported fields }
func (*ChatGptMessage) Descriptor
deprecated
func (*ChatGptMessage) Descriptor() ([]byte, []int)
Deprecated: Use ChatGptMessage.ProtoReflect.Descriptor instead.
func (*ChatGptMessage) GetRole ¶
func (x *ChatGptMessage) GetRole() RoleEnum
func (*ChatGptMessage) GetText ¶
func (x *ChatGptMessage) GetText() string
func (*ChatGptMessage) ProtoMessage ¶
func (*ChatGptMessage) ProtoMessage()
func (*ChatGptMessage) ProtoReflect ¶
func (x *ChatGptMessage) ProtoReflect() protoreflect.Message
func (*ChatGptMessage) Reset ¶
func (x *ChatGptMessage) Reset()
func (*ChatGptMessage) String ¶
func (x *ChatGptMessage) String() string
type ChatGptServiceClient ¶
type ChatGptServiceClient interface {
Answer(ctx context.Context, in *AnswerReq, opts ...grpc.CallOption) (*AnswerResp, error)
}
ChatGptServiceClient is the client API for ChatGptService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewChatGptServiceClient ¶
func NewChatGptServiceClient(cc grpc.ClientConnInterface) ChatGptServiceClient
type ChatGptServiceServer ¶
type ChatGptServiceServer interface { Answer(context.Context, *AnswerReq) (*AnswerResp, error) // contains filtered or unexported methods }
ChatGptServiceServer is the server API for ChatGptService service. All implementations must embed UnimplementedChatGptServiceServer for forward compatibility
type RoleEnum ¶
type RoleEnum int32
func (RoleEnum) Descriptor ¶
func (RoleEnum) Descriptor() protoreflect.EnumDescriptor
func (RoleEnum) EnumDescriptor
deprecated
func (RoleEnum) Number ¶
func (x RoleEnum) Number() protoreflect.EnumNumber
func (RoleEnum) Type ¶
func (RoleEnum) Type() protoreflect.EnumType
type UnimplementedChatGptServiceServer ¶
type UnimplementedChatGptServiceServer struct { }
UnimplementedChatGptServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedChatGptServiceServer) Answer ¶
func (UnimplementedChatGptServiceServer) Answer(context.Context, *AnswerReq) (*AnswerResp, error)
type UnsafeChatGptServiceServer ¶
type UnsafeChatGptServiceServer interface {
// contains filtered or unexported methods
}
UnsafeChatGptServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatGptServiceServer will result in compilation errors.