Find answers from the community

Home
Members
itachi_uchiha
i
itachi_uchiha
Offline, last seen 2 months ago
Joined November 7, 2024
I am trying to get the nodes from the retrieve funcion
but I am getting empty list as 'nodes' results.

import openai
#from openai import OpenAI
import os
import sys
from collections import Counter
import json
sys.path.append('../..')

from dotenv import load_dotenv, finddotenv = load_dotenv(find_dotenv()) # read local .env file

openai.api_key = os.environ['OPENAI_API_KEY']
client = OpenAI()
import nest_asyncio
nest_asyncio.apply()

embed_model = OpenAIEmbedding(model='text-embedding-3-small')
llm = OpenAI(temperature=0, model="gpt-4o-mini")

documents = SimpleDirectoryReader(
"......../small_docs"
).load_data()

index = PropertyGraphIndex.from_documents(
documents,
)

from llama_index.core.indices.property_graph import VectorContextRetriever

vector_retriever = VectorContextRetriever(
index.property_graph_store,
embed_model=embed_model,
include_text=False,
similarity_top_k=2,
path_depth=1,
)

retriever2 = index.as_retriever(sub_retrievers=[vector_retriever])
6 comments
i
L