puttrainedmodel

package
v8.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Creates an inference trained model.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type NewPutTrainedModel

type NewPutTrainedModel func(modelid string) *PutTrainedModel

NewPutTrainedModel type alias for index.

func NewPutTrainedModelFunc

func NewPutTrainedModelFunc(tp elastictransport.Interface) NewPutTrainedModel

NewPutTrainedModelFunc returns a new instance of PutTrainedModel with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type PutTrainedModel

type PutTrainedModel struct {
	// contains filtered or unexported fields
}

func (*PutTrainedModel) CompressedDefinition added in v8.9.0

func (r *PutTrainedModel) CompressedDefinition(compresseddefinition string) *PutTrainedModel

CompressedDefinition The compressed (GZipped and Base64 encoded) inference definition of the model. If compressed_definition is specified, then definition cannot be specified. API name: compressed_definition

func (*PutTrainedModel) DeferDefinitionDecompression

func (r *PutTrainedModel) DeferDefinitionDecompression(deferdefinitiondecompression bool) *PutTrainedModel

DeferDefinitionDecompression If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations. API name: defer_definition_decompression

func (*PutTrainedModel) Definition added in v8.9.0

func (r *PutTrainedModel) Definition(definition *types.Definition) *PutTrainedModel

Definition The inference definition for the model. If definition is specified, then compressed_definition cannot be specified. API name: definition

func (*PutTrainedModel) Description added in v8.9.0

func (r *PutTrainedModel) Description(description string) *PutTrainedModel

Description A human-readable description of the inference trained model. API name: description

func (PutTrainedModel) Do

func (r PutTrainedModel) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a puttrainedmodel.Response

func (*PutTrainedModel) Header

func (r *PutTrainedModel) Header(key, value string) *PutTrainedModel

Header set a key, value pair in the PutTrainedModel headers map.

func (*PutTrainedModel) HttpRequest

func (r *PutTrainedModel) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*PutTrainedModel) InferenceConfig added in v8.9.0

func (r *PutTrainedModel) InferenceConfig(inferenceconfig *types.InferenceConfigCreateContainer) *PutTrainedModel

InferenceConfig The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model's target_type. For pre-packaged models such as ELSER the config is not required. API name: inference_config

func (*PutTrainedModel) Input added in v8.9.0

func (r *PutTrainedModel) Input(input *types.Input) *PutTrainedModel

Input The input field names for the model definition. API name: input

func (*PutTrainedModel) Metadata added in v8.9.0

func (r *PutTrainedModel) Metadata(metadata interface{}) *PutTrainedModel

Metadata An object map that contains metadata about the model. API name: metadata

metadata should be a json.RawMessage or a structure if a structure is provided, the client will defer a json serialization prior to sending the payload to Elasticsearch.

func (*PutTrainedModel) ModelSizeBytes added in v8.9.0

func (r *PutTrainedModel) ModelSizeBytes(modelsizebytes int64) *PutTrainedModel

ModelSizeBytes The estimated memory usage in bytes to keep the trained model in memory. This property is supported only if defer_definition_decompression is true or the model definition is not supplied. API name: model_size_bytes

func (*PutTrainedModel) ModelType added in v8.9.0

ModelType The model type. API name: model_type

func (PutTrainedModel) Perform added in v8.7.0

func (r PutTrainedModel) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*PutTrainedModel) PlatformArchitecture added in v8.11.0

func (r *PutTrainedModel) PlatformArchitecture(platformarchitecture string) *PutTrainedModel

PlatformArchitecture The platform architecture (if applicable) of the trained mode. If the model only works on one platform, because it is heavily optimized for a particular processor architecture and OS combination, then this field specifies which. The format of the string must match the platform identifiers used by Elasticsearch, so one of, `linux-x86_64`, `linux-aarch64`, `darwin-x86_64`, `darwin-aarch64`, or `windows-x86_64`. For portable models (those that work independent of processor architecture or OS features), leave this field unset. API name: platform_architecture

func (*PutTrainedModel) PrefixStrings added in v8.13.0

func (r *PutTrainedModel) PrefixStrings(prefixstrings *types.TrainedModelPrefixStrings) *PutTrainedModel

PrefixStrings Optional prefix strings applied at inference API name: prefix_strings

func (*PutTrainedModel) Raw

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*PutTrainedModel) Request

func (r *PutTrainedModel) Request(req *Request) *PutTrainedModel

Request allows to set the request property with the appropriate payload.

func (*PutTrainedModel) Tags added in v8.9.0

func (r *PutTrainedModel) Tags(tags ...string) *PutTrainedModel

Tags An array of tags to organize the model. API name: tags

func (*PutTrainedModel) WaitForCompletion added in v8.13.0

func (r *PutTrainedModel) WaitForCompletion(waitforcompletion bool) *PutTrainedModel

WaitForCompletion Whether to wait for all child operations (e.g. model download) to complete. API name: wait_for_completion

type Request

type Request struct {

	// CompressedDefinition The compressed (GZipped and Base64 encoded) inference definition of the
	// model. If compressed_definition is specified, then definition cannot be
	// specified.
	CompressedDefinition *string `json:"compressed_definition,omitempty"`
	// Definition The inference definition for the model. If definition is specified, then
	// compressed_definition cannot be specified.
	Definition *types.Definition `json:"definition,omitempty"`
	// Description A human-readable description of the inference trained model.
	Description *string `json:"description,omitempty"`
	// InferenceConfig The default configuration for inference. This can be either a regression
	// or classification configuration. It must match the underlying
	// definition.trained_model's target_type. For pre-packaged models such as
	// ELSER the config is not required.
	InferenceConfig *types.InferenceConfigCreateContainer `json:"inference_config,omitempty"`
	// Input The input field names for the model definition.
	Input *types.Input `json:"input,omitempty"`
	// Metadata An object map that contains metadata about the model.
	Metadata json.RawMessage `json:"metadata,omitempty"`
	// ModelSizeBytes The estimated memory usage in bytes to keep the trained model in memory.
	// This property is supported only if defer_definition_decompression is true
	// or the model definition is not supplied.
	ModelSizeBytes *int64 `json:"model_size_bytes,omitempty"`
	// ModelType The model type.
	ModelType *trainedmodeltype.TrainedModelType `json:"model_type,omitempty"`
	// PlatformArchitecture The platform architecture (if applicable) of the trained mode. If the model
	// only works on one platform, because it is heavily optimized for a particular
	// processor architecture and OS combination, then this field specifies which.
	// The format of the string must match the platform identifiers used by
	// Elasticsearch,
	// so one of, `linux-x86_64`, `linux-aarch64`, `darwin-x86_64`,
	// `darwin-aarch64`,
	// or `windows-x86_64`. For portable models (those that work independent of
	// processor
	// architecture or OS features), leave this field unset.
	PlatformArchitecture *string `json:"platform_architecture,omitempty"`
	// PrefixStrings Optional prefix strings applied at inference
	PrefixStrings *types.TrainedModelPrefixStrings `json:"prefix_strings,omitempty"`
	// Tags An array of tags to organize the model.
	Tags []string `json:"tags,omitempty"`
}

Request holds the request body struct for the package puttrainedmodel

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/ml/put_trained_model/MlPutTrainedModelRequest.ts#L29-L124

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

type Response added in v8.7.0

type Response struct {
	CompressedDefinition *string `json:"compressed_definition,omitempty"`
	// CreateTime The time when the trained model was created.
	CreateTime types.DateTime `json:"create_time,omitempty"`
	// CreatedBy Information on the creator of the trained model.
	CreatedBy *string `json:"created_by,omitempty"`
	// DefaultFieldMap Any field map described in the inference configuration takes precedence.
	DefaultFieldMap map[string]string `json:"default_field_map,omitempty"`
	// Description The free-text description of the trained model.
	Description *string `json:"description,omitempty"`
	// EstimatedHeapMemoryUsageBytes The estimated heap usage in bytes to keep the trained model in memory.
	EstimatedHeapMemoryUsageBytes *int `json:"estimated_heap_memory_usage_bytes,omitempty"`
	// EstimatedOperations The estimated number of operations to use the trained model.
	EstimatedOperations *int `json:"estimated_operations,omitempty"`
	// FullyDefined True if the full model definition is present.
	FullyDefined *bool `json:"fully_defined,omitempty"`
	// InferenceConfig The default configuration for inference. This can be either a regression,
	// classification, or one of the many NLP focused configurations. It must match
	// the underlying definition.trained_model's target_type. For pre-packaged
	// models such as ELSER the config is not required.
	InferenceConfig *types.InferenceConfigCreateContainer `json:"inference_config,omitempty"`
	// Input The input field names for the model definition.
	Input types.TrainedModelConfigInput `json:"input"`
	// LicenseLevel The license level of the trained model.
	LicenseLevel *string                     `json:"license_level,omitempty"`
	Location     *types.TrainedModelLocation `json:"location,omitempty"`
	// Metadata An object containing metadata about the trained model. For example, models
	// created by data frame analytics contain analysis_config and input objects.
	Metadata *types.TrainedModelConfigMetadata `json:"metadata,omitempty"`
	// ModelId Identifier for the trained model.
	ModelId        string         `json:"model_id"`
	ModelSizeBytes types.ByteSize `json:"model_size_bytes,omitempty"`
	// ModelType The model type
	ModelType     *trainedmodeltype.TrainedModelType `json:"model_type,omitempty"`
	PrefixStrings *types.TrainedModelPrefixStrings   `json:"prefix_strings,omitempty"`
	// Tags A comma delimited string of tags. A trained model can have many tags, or
	// none.
	Tags []string `json:"tags"`
	// Version The Elasticsearch version number in which the trained model was created.
	Version *string `json:"version,omitempty"`
}

Response holds the response body struct for the package puttrainedmodel

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/ml/put_trained_model/MlPutTrainedModelResponse.ts#L22-L24

func NewResponse added in v8.7.0

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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