Skip to content

Commit

Permalink
Merge branch 'main' into feature/flask-update
Browse files Browse the repository at this point in the history
  • Loading branch information
yus04 authored Jul 12, 2024
2 parents f727e46 + 5a601e3 commit a3f02a6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 47 deletions.
6 changes: 3 additions & 3 deletions 5.internal-document-search/scripts/prepdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ def create_search_index():
SimpleField(name="sourcepage", type="Edm.String", filterable=True, facetable=True),
SimpleField(name="sourcefile", type="Edm.String", filterable=True, facetable=True)
],
semantic_settings=SemanticSettings(
semantic_search=SemanticSearch(
configurations=[SemanticConfiguration(
name='default',
prioritized_fields=PrioritizedFields(
title_field=None, prioritized_content_fields=[SemanticField(field_name='content')]))])
prioritized_fields=SemanticPrioritizedFields(
title_field=None, content_fields=[SemanticField(field_name='content')]))])
)
if args.verbose: print(f"Creating {args.index} search index")
index_client.create_index(index)
Expand Down
12 changes: 6 additions & 6 deletions 5.internal-document-search/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pypdf==3.17.0
azure-identity==1.13.0
azure-search-documents==11.4.0b6
azure-ai-formrecognizer==3.2.1
azure-storage-blob==12.14.1
azure-identity==1.15.0
azure-search-documents==11.4.0
azure-ai-formrecognizer==3.3.2
azure-storage-blob==12.19.0
pypdf==4.0.2
typing==3.7.4.3
pycryptodome==3.19.1
pycryptodome==3.20.0
29 changes: 0 additions & 29 deletions 5.internal-document-search/src/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import urllib.parse
from flask import Flask, request, jsonify

import tiktoken
import openai

from azure.identity import DefaultAzureCredential
Expand Down Expand Up @@ -32,34 +31,6 @@
AZURE_OPENAI_SERVICE = os.environ.get("AZURE_OPENAI_SERVICE")
AZURE_OPENAI_API_VERSION = os.environ.get("AZURE_OPENAI_API_VERSION")

AZURE_OPENAI_GPT_35_TURBO_DEPLOYMENT = os.environ.get("AZURE_OPENAI_GPT_35_TURBO_DEPLOYMENT")
AZURE_OPENAI_GPT_35_TURBO_16K_DEPLOYMENT = os.environ.get("AZURE_OPENAI_GPT_35_TURBO_16K_DEPLOYMENT")
AZURE_OPENAI_GPT_4_DEPLOYMENT = os.environ.get("AZURE_OPENAI_GPT_4_DEPLOYMENT")
AZURE_OPENAI_GPT_4_32K_DEPLOYMENT = os.environ.get("AZURE_OPENAI_GPT_4_32K_DEPLOYMENT")

gpt_models = {
"gpt-3.5-turbo": {
"deployment": AZURE_OPENAI_GPT_35_TURBO_DEPLOYMENT,
"max_tokens": 4096,
"encoding": tiktoken.encoding_for_model("gpt-3.5-turbo")
},
"gpt-3.5-turbo-16k": {
"deployment": AZURE_OPENAI_GPT_35_TURBO_16K_DEPLOYMENT,
"max_tokens": 16384,
"encoding": tiktoken.encoding_for_model("gpt-3.5-turbo")
},
"gpt-4": {
"deployment": AZURE_OPENAI_GPT_4_DEPLOYMENT,
"max_tokens": 8192,
"encoding": tiktoken.encoding_for_model("gpt-4")
},
"gpt-4-32k": {
"deployment": AZURE_OPENAI_GPT_4_32K_DEPLOYMENT,
"max_tokens": 32768,
"encoding": tiktoken.encoding_for_model("gpt-4-32k")
}
}

# Use the current user identity to authenticate with Azure OpenAI, Cognitive Search and Blob Storage (no secrets needed,
# just use 'az login' locally, and managed identity when deployed on Azure). If you need to use keys, use separate AzureKeyCredential instances with the
# keys for each service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def run(self, user_name: str, history: list[dict], overrides: dict) -> any:
r = self.search_client.search(query_text,
filter=filter,
query_type=QueryType.SEMANTIC,
query_language="en-us",
query_speller="lexicon",
semantic_configuration_name="default",
top=top,
query_caption="extractive|highlight-false" if use_semantic_captions else None
Expand Down
15 changes: 8 additions & 7 deletions 5.internal-document-search/src/backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
azure-identity==1.13.0
azure-identity==1.15.0
Flask==3.0.2
openai==0.27.7
azure-search-documents==11.4.0b6
azure-storage-blob==12.14.1
azure-cosmos==4.5.0
azure-search-documents==11.4.0
azure-storage-blob==12.19.0
azure-cosmos==4.5.1
opencensus-ext-azure==1.1.9
tiktoken==0.4.0
azure-monitor-opentelemetry==1.0.0b15
opentelemetry-instrumentation-flask==0.40b0
azure-monitor-opentelemetry==1.2.0
opencensus-ext-azure==1.1.13
tiktoken==0.6.0
opentelemetry-instrumentation-flask==0.44b0

0 comments on commit a3f02a6

Please sign in to comment.