sagemaker.serve.builder.schema_builder#

Placeholder docstring

Classes

CSVSerializerWrapper([content_type])

Wraps the CSVSerializer because it does not convert dataframe to bytes

DeserializerWrapper(deserializer, accept)

Wraps the deserializer to comply with the function signature.

JSONSerializerWrapper([content_type])

Wraps the JSONSerializer because it does not convert jsonable to bytes

SchemaBuilder(sample_input, sample_output[, ...])

Automatically detects the serializer and deserializer for your model.

class sagemaker.serve.builder.schema_builder.CSVSerializerWrapper(content_type='text/csv')[source]#

Bases: CSVSerializer

Wraps the CSVSerializer because it does not convert dataframe to bytes

serialize(data) bytes[source]#

Placeholder docstring

class sagemaker.serve.builder.schema_builder.DeserializerWrapper(deserializer, accept)[source]#

Bases: BaseDeserializer

Wraps the deserializer to comply with the function signature.

property ACCEPT#

Placeholder docstring

deserialize(stream, content_type: str | None = None)[source]#

Deserialize stream into object

class sagemaker.serve.builder.schema_builder.JSONSerializerWrapper(content_type='application/json')[source]#

Bases: JSONSerializer

Wraps the JSONSerializer because it does not convert jsonable to bytes

serialize(data) bytes[source]#

Placeholder docstring

class sagemaker.serve.builder.schema_builder.SchemaBuilder(sample_input, sample_output, input_translator: CustomPayloadTranslator | None = None, output_translator: CustomPayloadTranslator | None = None)[source]#

Bases: TritonSchemaBuilder

Automatically detects the serializer and deserializer for your model.

This is done by inspecting the sample_input and sample_output object. Alternatively, provide your custom serializer and deserializer for your request or response by creating a class that inherits CustomPayloadTranslator and provide it to SchemaBuilder.

Parameters:
  • sample_input (object) – Sample input to the model which can be used for testing. The schema builder internally generates the content type and corresponding serializing functions.

  • sample_output (object) – Sample output to the model which can be used for testing. The schema builder internally generates the accept type and corresponding serializing functions.

  • input_translator (Optional[CustomPayloadTranslator]) – If you want to define your own serialization method for the payload, you can implement your functions for translation.

  • output_translator (Optional[CustomPayloadTranslator]) – If you want to define your own serialization method for the output, you can implement your functions for translation.

generate_marshalling_map() dict[source]#

Generate marshalling map for the schema builder

get_input_sample() object[source]#

Get input sample for the schema builder