Skip to content

Sagemaker huggingface embedding model driver

SageMakerHuggingFaceEmbeddingModelDriver

Bases: BaseEmbeddingModelDriver

Source code in griptape/griptape/drivers/embedding_model/sagemaker_huggingface_embedding_model_driver.py
@define
class SageMakerHuggingFaceEmbeddingModelDriver(BaseEmbeddingModelDriver):
    def chunk_to_model_params(self, chunk: str) -> dict:
        return {"text_inputs": chunk}

    def process_output(self, output: dict) -> list[float]:
        return output["embedding"][0]

chunk_to_model_params(chunk)

Source code in griptape/griptape/drivers/embedding_model/sagemaker_huggingface_embedding_model_driver.py
def chunk_to_model_params(self, chunk: str) -> dict:
    return {"text_inputs": chunk}

process_output(output)

Source code in griptape/griptape/drivers/embedding_model/sagemaker_huggingface_embedding_model_driver.py
def process_output(self, output: dict) -> list[float]:
    return output["embedding"][0]