Chunk
Defines the Chunk schema, which represents a chunk of content retrieved from a vector store.
Chunk
Bases: BaseModel
Represents a chunk of content retrieved from a vector store.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
A unique identifier for the chunk. Defaults to a random UUID. |
content |
str | bytes | None
|
The content of the chunk, either text, binary, or None. |
metadata |
dict[str, Any]
|
Additional metadata associated with the chunk. Defaults to an empty dictionary. |
score |
float | None
|
Similarity score of the chunk (if available). Defaults to None. |
__repr__()
Return a string representation of the Chunk.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The string representation of the Chunk. |
is_binary()
Check if the content is binary.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the content is binary, False otherwise. |
is_text()
Check if the content is text.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the content is text, False otherwise. |