text_classification

package
v0.0.0-...-5fa7aab Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextClassificationService_Classify_FullMethodName        = "/yandex.cloud.ai.foundation_models.v1.text_classification.TextClassificationService/Classify"
	TextClassificationService_FewShotClassify_FullMethodName = "/yandex.cloud.ai.foundation_models.v1.text_classification.TextClassificationService/FewShotClassify"
)

Variables

View Source
var File_yandex_cloud_ai_foundation_models_v1_text_classification_text_classification_proto protoreflect.FileDescriptor
View Source
var File_yandex_cloud_ai_foundation_models_v1_text_classification_text_classification_service_proto protoreflect.FileDescriptor
View Source
var TextClassificationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.ai.foundation_models.v1.text_classification.TextClassificationService",
	HandlerType: (*TextClassificationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Classify",
			Handler:    _TextClassificationService_Classify_Handler,
		},
		{
			MethodName: "FewShotClassify",
			Handler:    _TextClassificationService_FewShotClassify_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/foundation_models/v1/text_classification/text_classification_service.proto",
}

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

Functions

func RegisterTextClassificationServiceServer

func RegisterTextClassificationServiceServer(s grpc.ServiceRegistrar, srv TextClassificationServiceServer)

Types

type ClassificationLabel

type ClassificationLabel struct {

	// A label with a class name.
	Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	// Confidence of item's belonging to a class.
	Confidence float64 `protobuf:"fixed64,2,opt,name=confidence,proto3" json:"confidence,omitempty"`
	// contains filtered or unexported fields
}

A pair of text label and corresponding confidence used in classification problems.

func (*ClassificationLabel) Descriptor deprecated

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

Deprecated: Use ClassificationLabel.ProtoReflect.Descriptor instead.

func (*ClassificationLabel) GetConfidence

func (x *ClassificationLabel) GetConfidence() float64

func (*ClassificationLabel) GetLabel

func (x *ClassificationLabel) GetLabel() string

func (*ClassificationLabel) ProtoMessage

func (*ClassificationLabel) ProtoMessage()

func (*ClassificationLabel) ProtoReflect

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

func (*ClassificationLabel) Reset

func (x *ClassificationLabel) Reset()

func (*ClassificationLabel) SetConfidence

func (m *ClassificationLabel) SetConfidence(v float64)

func (*ClassificationLabel) SetLabel

func (m *ClassificationLabel) SetLabel(v string)

func (*ClassificationLabel) String

func (x *ClassificationLabel) String() string

type ClassificationSample

type ClassificationSample struct {

	// Text sample.
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// Expected label for a given text.
	Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
	// contains filtered or unexported fields
}

Description of a sample for the classification task.

func (*ClassificationSample) Descriptor deprecated

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

Deprecated: Use ClassificationSample.ProtoReflect.Descriptor instead.

func (*ClassificationSample) GetLabel

func (x *ClassificationSample) GetLabel() string

func (*ClassificationSample) GetText

func (x *ClassificationSample) GetText() string

func (*ClassificationSample) ProtoMessage

func (*ClassificationSample) ProtoMessage()

func (*ClassificationSample) ProtoReflect

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

func (*ClassificationSample) Reset

func (x *ClassificationSample) Reset()

func (*ClassificationSample) SetLabel

func (m *ClassificationSample) SetLabel(v string)

func (*ClassificationSample) SetText

func (m *ClassificationSample) SetText(v string)

func (*ClassificationSample) String

func (x *ClassificationSample) String() string

type FewShotTextClassificationRequest

type FewShotTextClassificationRequest struct {

	// The identifier of the classification model.
	ModelUri string `protobuf:"bytes,1,opt,name=model_uri,json=modelUri,proto3" json:"model_uri,omitempty"`
	// Text description of the classification task.
	TaskDescription string `protobuf:"bytes,2,opt,name=task_description,json=taskDescription,proto3" json:"task_description,omitempty"`
	// List of available labels for the classification result.
	Labels []string `protobuf:"bytes,3,rep,name=labels,proto3" json:"labels,omitempty"`
	// Text for classification.
	Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
	// Optional set of text samples with expected labels that may be used as an additional hint for the classifier.
	Samples []*ClassificationSample `protobuf:"bytes,5,rep,name=samples,proto3" json:"samples,omitempty"`
	// contains filtered or unexported fields
}

Request for the service to classify text.

func (*FewShotTextClassificationRequest) Descriptor deprecated

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

Deprecated: Use FewShotTextClassificationRequest.ProtoReflect.Descriptor instead.

func (*FewShotTextClassificationRequest) GetLabels

func (x *FewShotTextClassificationRequest) GetLabels() []string

func (*FewShotTextClassificationRequest) GetModelUri

func (x *FewShotTextClassificationRequest) GetModelUri() string

func (*FewShotTextClassificationRequest) GetSamples

func (*FewShotTextClassificationRequest) GetTaskDescription

func (x *FewShotTextClassificationRequest) GetTaskDescription() string

func (*FewShotTextClassificationRequest) GetText

func (*FewShotTextClassificationRequest) ProtoMessage

func (*FewShotTextClassificationRequest) ProtoMessage()

func (*FewShotTextClassificationRequest) ProtoReflect

func (*FewShotTextClassificationRequest) Reset

func (*FewShotTextClassificationRequest) SetLabels

func (m *FewShotTextClassificationRequest) SetLabels(v []string)

func (*FewShotTextClassificationRequest) SetModelUri

func (m *FewShotTextClassificationRequest) SetModelUri(v string)

func (*FewShotTextClassificationRequest) SetSamples

func (*FewShotTextClassificationRequest) SetTaskDescription

func (m *FewShotTextClassificationRequest) SetTaskDescription(v string)

func (*FewShotTextClassificationRequest) SetText

func (*FewShotTextClassificationRequest) String

type FewShotTextClassificationResponse

type FewShotTextClassificationResponse struct {

	// Result of classification - a list of label-confidence pairs.
	Predictions []*ClassificationLabel `protobuf:"bytes,1,rep,name=predictions,proto3" json:"predictions,omitempty"`
	// Model version (changes with model releases).
	ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"`
	// contains filtered or unexported fields
}

Response containing classifier predictions.

func (*FewShotTextClassificationResponse) Descriptor deprecated

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

Deprecated: Use FewShotTextClassificationResponse.ProtoReflect.Descriptor instead.

func (*FewShotTextClassificationResponse) GetModelVersion

func (x *FewShotTextClassificationResponse) GetModelVersion() string

func (*FewShotTextClassificationResponse) GetPredictions

func (*FewShotTextClassificationResponse) ProtoMessage

func (*FewShotTextClassificationResponse) ProtoMessage()

func (*FewShotTextClassificationResponse) ProtoReflect

func (*FewShotTextClassificationResponse) Reset

func (*FewShotTextClassificationResponse) SetModelVersion

func (m *FewShotTextClassificationResponse) SetModelVersion(v string)

func (*FewShotTextClassificationResponse) SetPredictions

func (*FewShotTextClassificationResponse) String

type TextClassificationRequest

type TextClassificationRequest struct {

	// The identifier of the classification model.
	ModelUri string `protobuf:"bytes,1,opt,name=model_uri,json=modelUri,proto3" json:"model_uri,omitempty"`
	// Text for classification.
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

Request for the service to classify text.

func (*TextClassificationRequest) Descriptor deprecated

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

Deprecated: Use TextClassificationRequest.ProtoReflect.Descriptor instead.

func (*TextClassificationRequest) GetModelUri

func (x *TextClassificationRequest) GetModelUri() string

func (*TextClassificationRequest) GetText

func (x *TextClassificationRequest) GetText() string

func (*TextClassificationRequest) ProtoMessage

func (*TextClassificationRequest) ProtoMessage()

func (*TextClassificationRequest) ProtoReflect

func (*TextClassificationRequest) Reset

func (x *TextClassificationRequest) Reset()

func (*TextClassificationRequest) SetModelUri

func (m *TextClassificationRequest) SetModelUri(v string)

func (*TextClassificationRequest) SetText

func (m *TextClassificationRequest) SetText(v string)

func (*TextClassificationRequest) String

func (x *TextClassificationRequest) String() string

type TextClassificationResponse

type TextClassificationResponse struct {

	// Result of classification - a list of label-confidence pairs.
	Predictions []*ClassificationLabel `protobuf:"bytes,1,rep,name=predictions,proto3" json:"predictions,omitempty"`
	// Model version (changes with model releases).
	ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"`
	// contains filtered or unexported fields
}

Response containing classifier predictions.

func (*TextClassificationResponse) Descriptor deprecated

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

Deprecated: Use TextClassificationResponse.ProtoReflect.Descriptor instead.

func (*TextClassificationResponse) GetModelVersion

func (x *TextClassificationResponse) GetModelVersion() string

func (*TextClassificationResponse) GetPredictions

func (x *TextClassificationResponse) GetPredictions() []*ClassificationLabel

func (*TextClassificationResponse) ProtoMessage

func (*TextClassificationResponse) ProtoMessage()

func (*TextClassificationResponse) ProtoReflect

func (*TextClassificationResponse) Reset

func (x *TextClassificationResponse) Reset()

func (*TextClassificationResponse) SetModelVersion

func (m *TextClassificationResponse) SetModelVersion(v string)

func (*TextClassificationResponse) SetPredictions

func (m *TextClassificationResponse) SetPredictions(v []*ClassificationLabel)

func (*TextClassificationResponse) String

func (x *TextClassificationResponse) String() string

type TextClassificationServiceClient

type TextClassificationServiceClient interface {
	// RPC method for text classification.
	Classify(ctx context.Context, in *TextClassificationRequest, opts ...grpc.CallOption) (*TextClassificationResponse, error)
	// RPC method for few-shot text classification.
	FewShotClassify(ctx context.Context, in *FewShotTextClassificationRequest, opts ...grpc.CallOption) (*FewShotTextClassificationResponse, error)
}

TextClassificationServiceClient is the client API for TextClassificationService 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 TextClassificationServiceServer

type TextClassificationServiceServer interface {
	// RPC method for text classification.
	Classify(context.Context, *TextClassificationRequest) (*TextClassificationResponse, error)
	// RPC method for few-shot text classification.
	FewShotClassify(context.Context, *FewShotTextClassificationRequest) (*FewShotTextClassificationResponse, error)
}

TextClassificationServiceServer is the server API for TextClassificationService service. All implementations should embed UnimplementedTextClassificationServiceServer for forward compatibility

type UnimplementedTextClassificationServiceServer

type UnimplementedTextClassificationServiceServer struct {
}

UnimplementedTextClassificationServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedTextClassificationServiceServer) Classify

type UnsafeTextClassificationServiceServer

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

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

Jump to

Keyboard shortcuts

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