textv1

package
v0.0.0-...-a4c1032 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package textv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	MinimaxService_ChatCompletions_FullMethodName      = "/claude.text.v1.MinimaxService/ChatCompletions"
	MinimaxService_ChatCompletionStream_FullMethodName = "/claude.text.v1.MinimaxService/ChatCompletionStream"
)

Variables

View Source
var File_claude_text_v1_chat_proto protoreflect.FileDescriptor
View Source
var File_claude_text_v1_chat_service_proto protoreflect.FileDescriptor
View Source
var MinimaxService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "claude.text.v1.MinimaxService",
	HandlerType: (*MinimaxServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ChatCompletions",
			Handler:    _MinimaxService_ChatCompletions_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ChatCompletionStream",
			Handler:       _MinimaxService_ChatCompletionStream_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "claude/text/v1/chat_service.proto",
}

MinimaxService_ServiceDesc is the grpc.ServiceDesc for MinimaxService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterMinimaxServiceHandler

func RegisterMinimaxServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterMinimaxServiceHandler registers the http handlers for service MinimaxService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterMinimaxServiceHandlerClient

func RegisterMinimaxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MinimaxServiceClient) error

RegisterMinimaxServiceHandlerClient registers the http handlers for service MinimaxService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MinimaxServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MinimaxServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MinimaxServiceClient" to call the correct interceptors.

func RegisterMinimaxServiceHandlerFromEndpoint

func RegisterMinimaxServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterMinimaxServiceHandlerFromEndpoint is same as RegisterMinimaxServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterMinimaxServiceHandlerServer

func RegisterMinimaxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MinimaxServiceServer) error

RegisterMinimaxServiceHandlerServer registers the http handlers for service MinimaxService to "mux". UnaryRPC :call MinimaxServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMinimaxServiceHandlerFromEndpoint instead.

func RegisterMinimaxServiceServer

func RegisterMinimaxServiceServer(s grpc.ServiceRegistrar, srv MinimaxServiceServer)

Types

type ChatCompletionsRequest

type ChatCompletionsRequest struct {

	// 目前只能取下面的值
	// claude-1
	// claude-1-100k
	// claude-instant-1
	// claude-instant-1-100k
	// or sub model
	// claude-1.3
	// claude-1.3-100k
	// claude-1.2
	// claude-1.0
	// claude-instant-1.1
	// claude-instant-1.1-100k
	// claude-instant-1.0
	Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// 停用词
	StopSequences []string `protobuf:"bytes,2,rep,name=stop_sequences,json=stopSequences,proto3" json:"stop_sequences,omitempty"`
	// 否 	是否以流式接口的形式返回数据,默认false。
	Stream bool `protobuf:"varint,3,opt,name=stream,proto3" json:"stream,omitempty"`
	// 最大token
	MaxTokensToSample int32 `protobuf:"varint,4,opt,name=max_tokens_to_sample,json=maxTokensToSample,proto3" json:"max_tokens_to_sample,omitempty"`
	// 对话问题、人物或功能设定 ,不可为空
	Messages []*Message `protobuf:"bytes,5,rep,name=messages,proto3" json:"messages,omitempty"`
	// 对话上下文信息。说明:"user_name": "我", "bot_name": "专家"
	Metadata    *UserMeta `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"`
	Temperature float32   `protobuf:"fixed32,7,opt,name=temperature,proto3" json:"temperature,omitempty"`
	TopP        float32   `protobuf:"fixed32,8,opt,name=top_p,json=topP,proto3" json:"top_p,omitempty"`
	TopK        int32     `protobuf:"varint,9,opt,name=top_k,json=topK,proto3" json:"top_k,omitempty"`
	Prompt      string    `protobuf:"bytes,10,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// contains filtered or unexported fields
}

func (*ChatCompletionsRequest) Descriptor deprecated

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

Deprecated: Use ChatCompletionsRequest.ProtoReflect.Descriptor instead.

func (*ChatCompletionsRequest) GetMaxTokensToSample

func (x *ChatCompletionsRequest) GetMaxTokensToSample() int32

func (*ChatCompletionsRequest) GetMessages

func (x *ChatCompletionsRequest) GetMessages() []*Message

func (*ChatCompletionsRequest) GetMetadata

func (x *ChatCompletionsRequest) GetMetadata() *UserMeta

func (*ChatCompletionsRequest) GetModel

func (x *ChatCompletionsRequest) GetModel() string

func (*ChatCompletionsRequest) GetPrompt

func (x *ChatCompletionsRequest) GetPrompt() string

func (*ChatCompletionsRequest) GetStopSequences

func (x *ChatCompletionsRequest) GetStopSequences() []string

func (*ChatCompletionsRequest) GetStream

func (x *ChatCompletionsRequest) GetStream() bool

func (*ChatCompletionsRequest) GetTemperature

func (x *ChatCompletionsRequest) GetTemperature() float32

func (*ChatCompletionsRequest) GetTopK

func (x *ChatCompletionsRequest) GetTopK() int32

func (*ChatCompletionsRequest) GetTopP

func (x *ChatCompletionsRequest) GetTopP() float32

func (*ChatCompletionsRequest) ProtoMessage

func (*ChatCompletionsRequest) ProtoMessage()

func (*ChatCompletionsRequest) ProtoReflect

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

func (*ChatCompletionsRequest) Reset

func (x *ChatCompletionsRequest) Reset()

func (*ChatCompletionsRequest) String

func (x *ChatCompletionsRequest) String() string

type ChatCompletionsResponse

type ChatCompletionsResponse struct {

	// 文本结果
	Completion string `protobuf:"bytes,1,opt,name=completion,proto3" json:"completion,omitempty"`
	// 模型名称
	Model string `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"`
	// 结束原因,枚举值
	StopReason string `protobuf:"bytes,3,opt,name=stop_reason,json=stopReason,proto3" json:"stop_reason,omitempty"`
	// 是否截断
	Truncated bool `protobuf:"varint,4,opt,name=truncated,proto3" json:"truncated,omitempty"`
	// 停止词
	Stop string `protobuf:"bytes,5,opt,name=stop,proto3" json:"stop,omitempty"`
	// 日志id
	LogId string `protobuf:"bytes,6,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"`
	// 异常信息
	Exception string `protobuf:"bytes,7,opt,name=exception,proto3" json:"exception,omitempty"`
	// 错误信息
	Error *ErrorResponse `protobuf:"bytes,8,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ChatCompletionsResponse) Descriptor deprecated

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

Deprecated: Use ChatCompletionsResponse.ProtoReflect.Descriptor instead.

func (*ChatCompletionsResponse) GetCompletion

func (x *ChatCompletionsResponse) GetCompletion() string

func (*ChatCompletionsResponse) GetError

func (x *ChatCompletionsResponse) GetError() *ErrorResponse

func (*ChatCompletionsResponse) GetException

func (x *ChatCompletionsResponse) GetException() string

func (*ChatCompletionsResponse) GetLogId

func (x *ChatCompletionsResponse) GetLogId() string

func (*ChatCompletionsResponse) GetModel

func (x *ChatCompletionsResponse) GetModel() string

func (*ChatCompletionsResponse) GetStop

func (x *ChatCompletionsResponse) GetStop() string

func (*ChatCompletionsResponse) GetStopReason

func (x *ChatCompletionsResponse) GetStopReason() string

func (*ChatCompletionsResponse) GetTruncated

func (x *ChatCompletionsResponse) GetTruncated() bool

func (*ChatCompletionsResponse) ProtoMessage

func (*ChatCompletionsResponse) ProtoMessage()

func (*ChatCompletionsResponse) ProtoReflect

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

func (*ChatCompletionsResponse) Reset

func (x *ChatCompletionsResponse) Reset()

func (*ChatCompletionsResponse) String

func (x *ChatCompletionsResponse) String() string

type ErrorResponse

type ErrorResponse struct {

	// 错误详情
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// 错误详情
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorResponse) Descriptor deprecated

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

Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.

func (*ErrorResponse) GetMessage

func (x *ErrorResponse) GetMessage() string

func (*ErrorResponse) GetType

func (x *ErrorResponse) GetType() string

func (*ErrorResponse) ProtoMessage

func (*ErrorResponse) ProtoMessage()

func (*ErrorResponse) ProtoReflect

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

func (*ErrorResponse) Reset

func (x *ErrorResponse) Reset()

func (*ErrorResponse) String

func (x *ErrorResponse) String() string

type Message

type Message struct {

	// 当前支持以下:
	// Human: 表示用户
	// Assistant: 表示对话助手
	Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
	// 对话内容,不能为空。
	Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetContent

func (x *Message) GetContent() string

func (*Message) GetRole

func (x *Message) GetRole() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type MinimaxServiceClient

type MinimaxServiceClient interface {
	ChatCompletions(ctx context.Context, in *ChatCompletionsRequest, opts ...grpc.CallOption) (*ChatCompletionsResponse, error)
	ChatCompletionStream(ctx context.Context, in *ChatCompletionsRequest, opts ...grpc.CallOption) (MinimaxService_ChatCompletionStreamClient, error)
}

MinimaxServiceClient is the client API for MinimaxService 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.

type MinimaxServiceServer

type MinimaxServiceServer interface {
	ChatCompletions(context.Context, *ChatCompletionsRequest) (*ChatCompletionsResponse, error)
	ChatCompletionStream(*ChatCompletionsRequest, MinimaxService_ChatCompletionStreamServer) error
}

MinimaxServiceServer is the server API for MinimaxService service. All implementations should embed UnimplementedMinimaxServiceServer for forward compatibility

type MinimaxService_ChatCompletionStreamClient

type MinimaxService_ChatCompletionStreamClient interface {
	Recv() (*ChatCompletionsResponse, error)
	grpc.ClientStream
}

type MinimaxService_ChatCompletionStreamServer

type MinimaxService_ChatCompletionStreamServer interface {
	Send(*ChatCompletionsResponse) error
	grpc.ServerStream
}

type UnimplementedMinimaxServiceServer

type UnimplementedMinimaxServiceServer struct {
}

UnimplementedMinimaxServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedMinimaxServiceServer) ChatCompletions

type UnsafeMinimaxServiceServer

type UnsafeMinimaxServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeMinimaxServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MinimaxServiceServer will result in compilation errors.

type UserMeta

type UserMeta struct {
	UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*UserMeta) Descriptor deprecated

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

Deprecated: Use UserMeta.ProtoReflect.Descriptor instead.

func (*UserMeta) GetUserId

func (x *UserMeta) GetUserId() string

func (*UserMeta) ProtoMessage

func (*UserMeta) ProtoMessage()

func (*UserMeta) ProtoReflect

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

func (*UserMeta) Reset

func (x *UserMeta) Reset()

func (*UserMeta) String

func (x *UserMeta) String() string

Jump to

Keyboard shortcuts

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