Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e10eed0

Browse filesBrowse files
committed
cleaned up code
1 parent 2aca9d4 commit e10eed0
Copy full SHA for e10eed0

File tree

2 files changed

+9
-8
lines changed
Filter options

2 files changed

+9
-8
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,5 @@ FodyWeavers.xsd
398398
*.sln.iml
399399

400400
# Customer
401-
readme.local.txt
401+
*.local.txt
402+
*.local.sql

‎vector-embeddings/03-find-similar-articles.sql

Copy file name to clipboardExpand all lines: vector-embeddings/03-find-similar-articles.sql
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
Create database credentials to store API key
33
*/
4-
if exists(select * from sys.[database_scoped_credentials] where name = 'https://<your-app-name>.openai.azure.com/openai/deployments/<deployment-id>')
4+
if exists(select * from sys.[database_scoped_credentials] where name = 'https://<your-app-name>.openai.azure.com')
55
begin
6-
drop database scoped credential [https://<your-app-name>.openai.azure.com/openai/deployments/<deployment-id>];
6+
drop database scoped credential [https://<your-app-name>.openai.azure.com];
77
end
8-
create database scoped credential [https://<your-app-name>.openai.azure.com/openai/deployments/<deployment-id>]
8+
create database scoped credential [https://<your-app-name>.openai.azure.com]
99
with identity = 'HTTPEndpointHeaders', secret = '{"api-key": "<api-key>"}';
1010
go
1111

@@ -18,7 +18,7 @@ declare @payload nvarchar(max) = json_object('input': @inputText);
1818
exec @retval = sp_invoke_external_rest_endpoint
1919
@url = 'https://<your-app-name>.openai.azure.com/openai/deployments/<deployment-id>?api-version=2023-03-15-preview',
2020
@method = 'POST',
21-
@credential = [https://<your-app-name>.openai.azure.com/openai/deployments/<deployment-id>],
21+
@credential = [https://<your-app-name>.openai.azure.com],
2222
@payload = @payload,
2323
@response = @response output;
2424
drop table if exists #response;
@@ -48,11 +48,11 @@ go
4848
drop table if exists #results;
4949
select top(50)
5050
v2.article_id,
51-
SUM(v1.[vector_value] * v2.[vector_value]) /
51+
sum(v1.[vector_value] * v2.[vector_value]) /
5252
(
53-
SQRT(SUM(v1.[vector_value] * v1.[vector_value]))
53+
sqrt(sum(v1.[vector_value] * v1.[vector_value]))
5454
*
55-
SQRT(SUM(v2.[vector_value] * v2.[vector_value]))
55+
sqrt(sum(v2.[vector_value] * v2.[vector_value]))
5656
) as cosine_distance
5757
into
5858
#results

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.