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
5 changes: 3 additions & 2 deletions Hybrid-Search/hybrid_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

for id, (content, embedding) in enumerate(zip(sentences, embeddings)):
cursor.execute(f"""
INSERT INTO dbo.documents (id, content, embedding) VALUES (?, ?, CAST(? AS VECTOR(384)));
INSERT INTO dbo.documents (id, content, embedding)
VALUES (?, ?, CAST(CAST(? as NVARCHAR(MAX)) AS VECTOR(384)));
""",
id,
content,
Expand All @@ -59,7 +60,7 @@
results = cursor.execute(f"""
DECLARE @k INT = ?;
DECLARE @q NVARCHAR(1000) = ?;
DECLARE @v VECTOR(384) = CAST(? AS VECTOR(384));
DECLARE @v VECTOR(384) = CAST(CAST(? as NVARCHAR(MAX)) AS VECTOR(384));
WITH keyword_search AS (
SELECT TOP(@k)
id,
Expand Down
19 changes: 19 additions & 0 deletions Langchain-SQL-RAG/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# Azure OpenAI Service details
AZURE_ENDPOINT="https://<yourdeployment>.openai.azure.com/"
AZURE_DEPLOYMENT_EMBEDDING_NAME="<embeddingmodeldeploymentname"
AZURE_DEPLOYMENT_CHATCOMPLETION_NAME="<chatcompletionmodeldeploymentname>"
AZURE_API_VERSION="2023-05-15"
AZURE_API_KEY="<yourkey"


#Blob Storage Account details
AZURE_CONN_STR="DefaultEndpointsProtocol=https;AccountName=<YourBlobName>;AccountKey=<YourAccountKey>;EndpointSuffix=core.windows.net"
AZURE_CONTAINER_NAME="YourContainerName"

# Use only one of the below. The one you are not using should be commented out.
# For Entra ID Service Principle Authentication
ENTRA_CONNECTION_STRING="Driver={ODBC Driver 18 for SQL Server};LongAsMax=yes;Server=tcp:<yourdbserver>.database.windows.net;Database=<yourdbname>;"

# For SQL Authentication
SQL_CONNECTION_STRING="Driver={ODBC Driver 18 for SQL Server};LongAsMax=yes;Server=tcp:<yourserver>.database.windows.net;Database=<database>;Uid=<your-username>;Pwd=<your-password>;"
21 changes: 21 additions & 0 deletions Langchain-SQL-RAG/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.pdf
*.docx
*.doc
*.xls
*.xlsx
*.ppt
*.pptx
*.txt
*.csv
*.jpg
*.jpeg
*.png
*.gif
*.bmp
*.tif
*.tiff
*.svg
*.eps
*.ai
*.psd
*.env
Loading