lancedb_haystack.conversion.python_to_lancedb
Functions
|
Converts a Haystack Document to a format ready to store in lancedb |
|
Converts the value of a field from it's representation in haystack to the one used for LanceDB |
|
Convert a dict into the format expected by LanceDB |
|
Convert datetime or iso string into the format expected by LanceDB. |
Module Contents
- lancedb_haystack.conversion.python_to_lancedb.convert_document_to_lancedb(document: haystack.Document, schema: pyarrow.Schema) dict
Converts a Haystack Document to a format ready to store in lancedb
- Parameters:
document – the Haystack document to prepare for insertion into LanceDB
schema – the lancedb table schema
- Returns:
a dict
- lancedb_haystack.conversion.python_to_lancedb.convert_field(value: Any, field_type: pyarrow.DataType)
Converts the value of a field from it’s representation in haystack to the one used for LanceDB
- Parameters:
value – the value to convert
field_type – The pyarrow type of the value, so we know how to convert it.
- Returns:
the converted value
- lancedb_haystack.conversion.python_to_lancedb.convert_struct(value: dict, field_type: pyarrow.StructType) dict
Convert a dict into the format expected by LanceDB
- Parameters:
value – the value to convert
field_type – The pyarrow type of the value, so we know how to convert it.
- Returns:
the converted value
- lancedb_haystack.conversion.python_to_lancedb.convert_timestamp(value: datetime.datetime | str, field_type: pyarrow.DataType) pyarrow.Scalar
Convert datetime or iso string into the format expected by LanceDB.
- Parameters:
value – the value to convert
field_type – The pyarrow type of the value, so we know how to convert it.
- Returns:
the converted value