Skip to content
Snippets Groups Projects
Unverified Commit 8cd9b290 authored by Eric Hare's avatar Eric Hare Committed by GitHub
Browse files

Fix #9612: Set node content for astra db (#9613)

parent 454a3838
Branches
Tags
No related merge requests found
...@@ -5,6 +5,7 @@ An index based on a DB table with vector search capabilities, ...@@ -5,6 +5,7 @@ An index based on a DB table with vector search capabilities,
powered by the astrapy library powered by the astrapy library
""" """
import json
import logging import logging
from typing import Any, Dict, List, Optional, cast from typing import Any, Dict, List, Optional, cast
...@@ -272,16 +273,17 @@ class AstraDBVectorStore(VectorStore): ...@@ -272,16 +273,17 @@ class AstraDBVectorStore(VectorStore):
top_k_ids = [] top_k_ids = []
# Get every match # Get every match
for my_match in matches: for match in matches:
# Grab the node information # Check whether we have a llama-generated node content field
my_match["_node_content"] = "{}" if "_node_content" not in match["metadata"]:
match["metadata"]["_node_content"] = json.dumps(match)
node = metadata_dict_to_node(my_match["metadata"]) # Create a new node object from the node metadata
node.set_content(my_match["content"]) node = metadata_dict_to_node(match["metadata"], text=match["content"])
# Append to the respective lists # Append to the respective lists
top_k_nodes.append(node) top_k_nodes.append(node)
top_k_ids.append(my_match["_id"]) top_k_ids.append(match["_id"])
# return our final result # return our final result
return VectorStoreQueryResult( return VectorStoreQueryResult(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment