Skip to content

Commit a80c4c0

Browse files
committed
improved sql code
1 parent 6d3f032 commit a80c4c0

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

db/sample/sample-data.sql renamed to db/samples/sample-data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ exec dbo.add_sample '
226226
{
227227
"name": "Chatbot on structured and unstructured data with Semantic Kernel",
228228
"description": "Using Azure SQL and Semantic Kernel to chat with your own data using a mix of NL2SQL and RAG",
229-
"notes": "A chatbot that can answer using RAG and using SQL Queries to answer any question you may want to ask it, be it on unstructured data (eg: what is the common issue raised for product XYZ) or on structured data (eg: how many customers from Canada called the support line?). Built using Semantic Kernel. This is the sample Davide used in many keynotes and demos, including PASS Summit 2024 and Live 360 Orlando 2024, where the data source was the database of a fictional insurance company, Contoso Insurance.",
229+
"notes": "This sample shows how to build a chatbot that can answer using RAG and using SQL Queries to answer any question you may want to ask it, be it on unstructured data (eg: what is the common issue raised for product XYZ) or on structured data (eg: how many customers from Canada called the support line?). Built using Semantic Kernel. This is the sample Davide used in many keynotes and demos, including PASS Summit 2024 and Live 360 Orlando 2024, where the data source was the database of a fictional insurance company, Contoso Insurance.",
230230
"url": "https://github.com/Azure-Samples/azure-sql-db-chat-sk",
231231
"details": {
232232
"author": "Davide Mauri",

db/sql/02-tables.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ create table dbo.samples
1616
[updated_on] datetime2(0) not null
1717
)
1818
go
19+
alter table dbo.samples
20+
add constraint uq__samples__url unique([url])
1921

2022
create table dbo.samples_embeddings
2123
(

db/sql/04-find_samples.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ begin
6464
'content':'
6565
You as a system assistant who helps users find code samples the user can use to learn the topic they are interested in.
6666
Samples are provided in an assitant message using a JSON Array with the following format: [{id, name, description, note, details, similiarity_score}].
67-
Use the provided samples to help you answer the user''s question.
6867
Put in sample_summary output property a markdown short summary of the sample using the provided description, notes, and details.
68+
Use only the provided samples to help you answer the user''s question.
6969
If there are related links or repos in the details, include them in the short summary.
70-
If the question is not answered by the samples, you can say that you don''t know.
71-
If users ask about topics you don''t know, answer that you don''t know.
72-
Return up to 10 samples if you can.
70+
If the question cannot be answered by the provided samples, you must say that you don''t know.
71+
If asked question is about topics you don''t know, answer that you don''t know.
7372
'
7473
),
7574
json_object(

db/sql/06-delete_sample.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ end
2828

2929
begin tran
3030

31-
delete from dbo.samples_embeddings where id = @id
32-
delete from dbo.samples_notes_embeddings where id = @id
33-
delete from dbo.samples_details_embeddings where id = @id
34-
delete from dbo.samples where id = @id
31+
delete from dbo.samples_embeddings where id = @sid
32+
delete from dbo.samples_notes_embeddings where id = @sid
33+
delete from dbo.samples_details_embeddings where id = @sid
34+
delete from dbo.samples where id = @sid
3535

3636
commit tran

0 commit comments

Comments
 (0)