Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to make OpenAI key work for dataStoreAgent #6

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading