Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This step guides you through using Azure CLI commands from the Azure Cloud Shell
STATE=$(az cognitiveservices account show -g "$RG_NAME" -n "$AOAI" --query "properties.provisioningState" -o tsv)
echo "provisioningState=$STATE"
[ "$STATE" = "Succeeded" ] && break
sleep 10
sleep 30
done

#3 OpenAI deployments: embedding + chat
Expand Down Expand Up @@ -139,7 +139,9 @@ You connect to the `ContosoHelpDesk` database on your Azure Database for Postgre

1. In the [Azure portal](https://portal.azure.com/), navigate to your newly created Azure Database for PostgreSQL server.

1. In the resource menu, under **Settings**, select **Databases** select **Connect** for the `ContosoHelpDesk` database. Selecting **Connect** doesn't actually connect you to the database; it simply provides instructions for connecting to the database using various methods. Review the instructions to **Connect from browser or locally** and use those instructions to connect using the Azure Cloud Shell.
1. In the resource menu, under **Settings**, select **Connect**, then select **ContosoHelpDesk** for the database.

1. Expand the section **Connect from browser or locally** and use the command shown to connect using the Azure Cloud Shell.

![Screenshot of the Azure Database for PostgreSQL Databases page. Databases and Connect for the ContosoHelpDesk database are highlighted by red boxes.](media/14-postgresql-database-connect.png)

Expand Down Expand Up @@ -357,7 +359,7 @@ On the GitHub repo you cloned, you can find the `app.py` file, which contains th

1. Review the libraries the application depends on. The main library you use for interacting with Azure OpenAI is `langchain_openai`.

1. our first function, `get_conn`, just creates a connection to the PostgreSQL database. This one is predefined for you. For the following three functions, replace the comments with actual code provided.
1. Our first function, `get_conn`, just creates a connection to the PostgreSQL database. This one is predefined for you. For the following three functions, replace the comments with actual code provided.

1. Replace the comment **# Retrieve top-k rows by cosine similarity (embedding must be present)** with the following script:

Expand Down Expand Up @@ -537,3 +539,4 @@ Additionally, you explored how to optimize query performance using vector indexe

Finally, you learned about the importance of monitoring and fine-tuning your application over time. As user queries evolve and the dataset expands, you need to revisit your indexing strategy, prompt design, and overall architecture to maintain optimal performance and accuracy.


12 changes: 10 additions & 2 deletions Instructions/Labs/14-exercise-implement-graph-rag.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This step guides you through using Azure CLI commands from the Azure Cloud Shell
STATE=$(az cognitiveservices account show -g "$RG_NAME" -n "$AOAI" --query "properties.provisioningState" -o tsv)
echo "provisioningState=$STATE"
[ "$STATE" = "Succeeded" ] && break
sleep 10
sleep 30
done

#3 OpenAI deployments: embedding + chat
Expand Down Expand Up @@ -138,7 +138,9 @@ You connect to the `ContosoHelpDesk` database on your Azure Database for Postgre

1. In the [Azure portal](https://portal.azure.com/), navigate to your newly created Azure Database for PostgreSQL server.

1. In the resource menu, under **Settings**, select **Databases** select **Connect** for the `ContosoHelpDesk` database. Selecting **Connect** doesn't actually connect you to the database; it simply provides instructions for connecting to the database using various methods. Review the instructions to **Connect from browser or locally** and use those instructions to connect using the Azure Cloud Shell.
1. In the resource menu, under **Settings**, select **Connect**, then select **ContosoHelpDesk** for the database.

1. Expand the section **Connect from browser or locally** and use the command shown to connect using the Azure Cloud Shell.

![Screenshot of the Azure Database for PostgreSQL Databases page. Databases and Connect for the ContosoHelpDesk database are highlighted by red boxes.](media/14-postgresql-database-connect.png)

Expand Down Expand Up @@ -432,7 +434,9 @@ Let's create the nodes from the company policies data.
```sql
-- Disable pagination for better output readability
\pset pager off
```

```sql
-- Upsert the policy nodes
SELECT public.policy_graph_upsert(policy_id, title, department, category, policy_text)
FROM public.company_policies
Expand Down Expand Up @@ -515,7 +519,9 @@ So far you added the nodes for policies, departments, categories, and topics. It
```sql
-- Disable pagination for better output readability
\pset pager off
```

```sql
-- BELONGS_TO
SELECT public.create_policy_link_in_policies_graph(policy_id, 'Department', department, 'BELONGS_TO')
FROM public.company_policies;
Expand Down Expand Up @@ -700,3 +706,5 @@ In this exercise, you used a small graph to add structure to retrieval. Instead

To apply the methods discussed here on your own data, start small. Pick a few entities and relationships that matter, link them to your rows, use a short `openCypher` query to fetch candidate `ids`, then apply vector ranking. Tighten or relax the filters as needed, swap in other concepts, and keep the workflow in SQL so it's straightforward to maintain.



Binary file modified Instructions/Labs/media/14-postgresql-database-connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.