text_classification

package
v0.0.0-...-aeb3b05 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 9 Imported by: 1

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 class name label.
	Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	// The probability of classifying text into a specific class.
	Confidence float64 `protobuf:"fixed64,2,opt,name=confidence,proto3" json:"confidence,omitempty"`
	// contains filtered or unexported fields
}

A pair of text labels and their corresponding confidence values.

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 [URI](/docs/foundation-models/concepts/classifier/models) of the classifier 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.
	// Give meaningful names to label classes: this is essential for correct classification results.
	// For example, use “chemistry“ and “physics“ rather than “chm“ and “phs“ for class names.
	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. For examples of usage, see [step-by-step guides](/docs/operations/classifier/readymade).

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 {

	// The classification results with the `confidence“ values
	// for the probability of classifying the request text into each class.
	Predictions []*ClassificationLabel `protobuf:"bytes,1,rep,name=predictions,proto3" json:"predictions,omitempty"`
	// The model version changes with each new 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 [URI](/docs/foundation-models/concepts/classifier/models) of your tuned classifier 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 with tuned model.

The names of the classes between which the model will be distributing requests must be specified during model tuning; therefore, they are not provided in the request.

For examples of usage, see [step-by-step guides](/docs/foundation-models/operations/classifier/additionally-trained).

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 {

	// The classification results with the `confidence“ values
	// for the probability of classifying the request text into each class.
	Predictions []*ClassificationLabel `protobuf:"bytes,1,rep,name=predictions,proto3" json:"predictions,omitempty"`
	// The model version changes with each new releases.
	ModelVersion string `protobuf:"bytes,2,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"`
	// contains filtered or unexported fields
}

Response with 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 to classify text with tuned model.
	//
	// The names of the classes between which the model will be distributing requests
	// must be specified during model tuning and are not provided in the request.
	Classify(ctx context.Context, in *TextClassificationRequest, opts ...grpc.CallOption) (*TextClassificationResponse, error)
	// RPC method for binary and multi-class classification.
	//
	// You can provide up to 20 classes for few-shot text classification
	// with optional examples.
	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.

Service for classifying the text requests provided in prompts.

type TextClassificationServiceServer

type TextClassificationServiceServer interface {
	// RPC method to classify text with tuned model.
	//
	// The names of the classes between which the model will be distributing requests
	// must be specified during model tuning and are not provided in the request.
	Classify(context.Context, *TextClassificationRequest) (*TextClassificationResponse, error)
	// RPC method for binary and multi-class classification.
	//
	// You can provide up to 20 classes for few-shot text classification
	// with optional examples.
	FewShotClassify(context.Context, *FewShotTextClassificationRequest) (*FewShotTextClassificationResponse, error)
}

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

Service for classifying the text requests provided in prompts.

type UnimplementedTextClassificationServiceServer

type UnimplementedTextClassificationServiceServer struct{}

UnimplementedTextClassificationServiceServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

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