Skip to content

Commit

Permalink
Changes to make OpenAI key work for dataStoreAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagan Singh committed Oct 22, 2024
1 parent 3483db5 commit a0eac98
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/src/utils/semantic_layer_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ async def enrich_nodes_properties(llm, model, finalised_graph_structure):
for new_node in enriched_node_properties["nodeProperties"]:
label = new_node["label"]
properties_to_add = new_node["properties"]

for node in finalised_graph_structure["nodes"]:
# Determine if the structure has nested 'nodes' or not
if isinstance(finalised_graph_structure["nodes"], dict):
# Nodes are nested under a "nodes" key in a dictionary in the case of OpenAI
node_list = finalised_graph_structure["nodes"]["nodes"]
else:
# Nodes are directly in the list in the case of Mistral
node_list = finalised_graph_structure["nodes"]
for node in node_list:
if node["label"] == label:
if "properties" not in node:
node["properties"] = []
Expand Down

0 comments on commit a0eac98

Please sign in to comment.