Hello Friends,
I need help, Please!
I am trying to create K.Graph with SimpleKGPipeline function from text.
Following is the configuration for SimpleKGPipeline with from_pdf=False
kg_builder_text = SimpleKGPipeline(
llm=ex_llm,
driver=driver,
text_splitter=FixedSizeSplitter(chunk_size=1500, chunk_overlap=100),
embedder=embedder,
entities=node_labels,
relations=rel_types,
prompt_template=prompt_template,
from_pdf=False
)
I have loaded data in dataframe from CSV file.
with open(file_path, 'r', encoding='utf-8') as file:
documents = [line.strip() for line in file if line.strip()]
df = pd.DataFrame(documents, columns=['document'])
I am trying to build a knowledge graph using run_async function.
for i, doc in enumerate(df['document']):
try:
result = await kg_builder_text.run_async({"text":doc})
except Exception as e:
print(f" Error on row {i}: {e}")
I am getting the error " Expected 'text' argument when 'from_pdf' is False." for all rows/document
I have done all checks as follows :
df = df[df['document'].notnull()]
df['document'] = df['document'].astype(str)
df = df[df['document'].str.strip() != '']
I also tried with creating a text file for every row in dataframe and then reading that in text field.
Even this is giving me same error. Please help/guide.
Thanks,
AD