ImageNode#

pydantic model llama_index.schema.ImageNode#

Node with image.

Show JSON schema
{
   "title": "ImageNode",
   "description": "Node with image.",
   "type": "object",
   "properties": {
      "id_": {
         "title": "Id ",
         "description": "Unique ID of the node.",
         "type": "string"
      },
      "embedding": {
         "title": "Embedding",
         "description": "Embedding of the node.",
         "type": "array",
         "items": {
            "type": "number"
         }
      },
      "extra_info": {
         "title": "Extra Info",
         "description": "A flat dictionary of metadata fields",
         "type": "object"
      },
      "excluded_embed_metadata_keys": {
         "title": "Excluded Embed Metadata Keys",
         "description": "Metadata keys that are excluded from text for the embed model.",
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "excluded_llm_metadata_keys": {
         "title": "Excluded Llm Metadata Keys",
         "description": "Metadata keys that are excluded from text for the LLM.",
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "relationships": {
         "title": "Relationships",
         "description": "A mapping of relationships to other node information.",
         "type": "object",
         "additionalProperties": {
            "anyOf": [
               {
                  "$ref": "#/definitions/RelatedNodeInfo"
               },
               {
                  "type": "array",
                  "items": {
                     "$ref": "#/definitions/RelatedNodeInfo"
                  }
               }
            ]
         }
      },
      "text": {
         "title": "Text",
         "description": "Text content of the node.",
         "default": "",
         "type": "string"
      },
      "start_char_idx": {
         "title": "Start Char Idx",
         "description": "Start char index of the node.",
         "type": "integer"
      },
      "end_char_idx": {
         "title": "End Char Idx",
         "description": "End char index of the node.",
         "type": "integer"
      },
      "text_template": {
         "title": "Text Template",
         "description": "Template for how text is formatted, with {content} and {metadata_str} placeholders.",
         "default": "{metadata_str}\n\n{content}",
         "type": "string"
      },
      "metadata_template": {
         "title": "Metadata Template",
         "description": "Template for how metadata is formatted, with {key} and {value} placeholders.",
         "default": "{key}: {value}",
         "type": "string"
      },
      "metadata_seperator": {
         "title": "Metadata Seperator",
         "description": "Separator between metadata fields when converting to string.",
         "default": "\n",
         "type": "string"
      },
      "image": {
         "title": "Image",
         "type": "string"
      },
      "image_path": {
         "title": "Image Path",
         "type": "string"
      },
      "image_url": {
         "title": "Image Url",
         "type": "string"
      },
      "image_mimetype": {
         "title": "Image Mimetype",
         "type": "string"
      },
      "text_embedding": {
         "title": "Text Embedding",
         "description": "Text embedding of image node, if text field is filled out",
         "type": "array",
         "items": {
            "type": "number"
         }
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "ImageNode"
      }
   },
   "definitions": {
      "ObjectType": {
         "title": "ObjectType",
         "description": "An enumeration.",
         "enum": [
            "1",
            "2",
            "3",
            "4"
         ],
         "type": "string"
      },
      "RelatedNodeInfo": {
         "title": "RelatedNodeInfo",
         "description": "Base component object to capture class names.",
         "type": "object",
         "properties": {
            "node_id": {
               "title": "Node Id",
               "type": "string"
            },
            "node_type": {
               "$ref": "#/definitions/ObjectType"
            },
            "metadata": {
               "title": "Metadata",
               "type": "object"
            },
            "hash": {
               "title": "Hash",
               "type": "string"
            },
            "class_name": {
               "title": "Class Name",
               "type": "string",
               "default": "RelatedNodeInfo"
            }
         },
         "required": [
            "node_id"
         ]
      }
   }
}

Config
  • allow_population_by_field_name: bool = True

  • validate_assignment: bool = True

Fields
field image: Optional[str] = None#
field image_mimetype: Optional[str] = None#
field image_path: Optional[str] = None#
field image_url: Optional[str] = None#
field text_embedding: Optional[List[float]] = None#

Text embedding of image node, if text field is filled out

classmethod class_name() str#

Get the class name, used as a unique ID in serialization.

This provides a key that makes serialization robust against actual class name changes.

classmethod get_type() str#

Get Object type.

resolve_image() Union[str, BytesIO]#

Resolve an image such that PIL can read it.