neo4j-labs / llm-graph-builder

Neo4j graph construction from unstructured data using LLMs
https://neo4j.com/labs/genai-ecosystem/llm-graph-builder/
Apache License 2.0
2.16k stars 329 forks source link

AttributeError: 'NoneType' object has no attribute 'upper' #403

Closed Daksh-S97 closed 1 week ago

Daksh-S97 commented 3 months ago

Hi, I'm running (DEV branch) on a local machine and my LLM is a GPT 4 hosted on Azure. I'm getting this error when I click 'Generate graph' on the frontend.

AttributeError: 'NoneType' object has no attribute 'upper'

Trace: Traceback (most recent call last): File "/mnt/c/Users/papai/Desktop/llm-graph-builder/backend/score.py", line 163, in extract_knowledge_graph_from_file result = await asyncio.to_thread( File "/home/daksh/miniconda3/envs/llm-kg/lib/python3.9/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) File "/home/daksh/miniconda3/envs/llm-kg/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/mnt/c/Users/papai/Desktop/llm-graph-builder/backend/src/main.py", line 167, in extract_graph_from_file_local_file return processing_source(graph, model, file_name, pages, allowedNodes, allowedRelationship, merged_file_path) File "/mnt/c/Users/papai/Desktop/llm-graph-builder/backend/src/main.py", line 273, in processing_source node_count,rel_count = processing_chunks(selected_chunks,graph,file_name,model,allowedNodes,allowedRelationship,node_count, rel_count) File "/mnt/c/Users/papai/Desktop/llm-graph-builder/backend/src/main.py", line 323, in processing_chunks update_embedding_create_vector_index( graph, chunkId_chunkDoc_list, file_name) File "/mnt/c/Users/papai/Desktop/llm-graph-builder/backend/src/make_relationships.py", line 52, in update_embedding_create_vector_index if isEmbedding.upper() == "TRUE": AttributeError: 'NoneType' object has no attribute 'upper'

Also, I'm not sure if it's using the LLM I provided. Any way to check that? These are my env variables:

OPENAI_API_KEY = (redacted) NEO4J_URI = neo4j+s://148ddd60.databases.neo4j.io NEO4J_USERNAME = neo4j NEO4J_PASSWORD = (redacted) BACKEND_API_URL = http://127.0.0.1:8000 GEMINI_ENABLED = False GCP_LOG_METRICS_ENABLED = False REACT_APP_SOURCES = local, s3, youtube, wiki UPDATE_GRAPH_CHUNKS_PROCESSED = 20 OPENAI_BASE_URL= (redacted)

aashipandya commented 2 months ago

Make sure IS_EMBEDDING environment variable is set

jexp commented 2 months ago

@aashipandya we should fall-back to true if it's not configured.