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

Fs 77/fix datastore complex query #30

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 additions & 1 deletion backend/src/agents/datastore_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ async def get_semantic_layer_cache(llm, model, graph_schema):

@agent(
name="DatastoreAgent",
description="This agent is responsible for handling database queries relating to the user's personal data.",
description=(
"This agent is responsible for handling database queries related to ESG (Environmental, Social, Governance) "
"data, including retrieving ESG scores, financial metrics, and other company-specific or fund-specific "
"information. It interacts with the graph database to extract, process, and return ESG-related information "
"from various sources, such as company sustainability reports or fund portfolios."
),
tools=[generate_cypher],
)
class DatastoreAgent(Agent):
Expand Down
17 changes: 16 additions & 1 deletion backend/src/utils/cyper_import_data_from_csv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import_data_from_csv_script = """
LOAD CSV WITH HEADERS FROM 'file:///esg_poc.csv' AS row

MERGE (f:Fund {Name: row.`Fund Name`, Size: toFloat(row.`Fund Size (Billion USD)`)})
MERGE (f:Fund {Name: row.`Fund Name`, Size: toFloat(row.`Fund Size (Billion USD)`),
SizeUnit:
CASE
WHEN "Fund Size (Billion USD)" in keys(row) THEN "Billion"
WHEN "Fund Size (Million USD)" IN keys(row) THEN "Million"
WHEN "Fund Size (Thousand USD)" IN keys(row) THEN "Thousand"
ELSE "Unknown"
END,
Currency:
CASE
WHEN "Fund Size (Billion USD)" IN keys(row) THEN "USD"
WHEN "Fund Size (Billion EUR)" IN keys(row) THEN "EUR"
WHEN "Fund Size (Billion GBP)" IN keys(row) THEN "GBP"
ELSE "USD"
END
})

MERGE (c:Company {Name: row.`Company Name`})

Expand Down
Loading