You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -53,14 +53,14 @@ You can run this repo virtually by using GitHub Codespaces or VS Code Remote Con
53
53
1. Create a new folder and switch to it in the terminal
54
54
1. Run `azd auth login`
55
55
1. Run `azd init -t azure-search-openai-demo`
56
-
* For the target location, the regions that currently support the models used in this sample are **East US** or **South Central US**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/models)
57
56
* note that this command will initialize a git repository and you do not need to clone this repository
58
57
59
58
#### Starting from scratch
60
59
61
60
Execute the following command, if you don't have any pre-existing Azure services and want to start from a fresh deployment.
62
61
63
62
1. Run `azd up` - This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
63
+
* For the target location, the regions that currently support the models used in this sample are **East US**, **France Central**, **South Central US**, **UK South**, and **West Europe**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/models)
64
64
1. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.
65
65
66
66
It will look like the following:
@@ -129,4 +129,4 @@ Once in the web app:
129
129
130
130
If you see this error while running `azd deploy`: `read /tmp/azd1992237260/backend_env/lib64: is a directory`, then delete the `./app/backend/backend_env folder` and re-run the `azd deploy` command. This issue is being tracked here: <https://github.com/Azure/azure-dev/issues/1237>
131
131
132
-
If the web app fails to deploy and you receive a '404 Not Found' message in your browser, run 'azd deploy'.
132
+
If the web app fails to deploy and you receive a '404 Not Found' message in your browser, run `azd deploy`.
Copy file name to clipboardExpand all lines: app/backend/approaches/chatreadretrieveread.py
+13-8
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,23 @@
1
+
fromtypingimportAny, Sequence
2
+
1
3
importopenai
2
4
fromazure.search.documentsimportSearchClient
3
5
fromazure.search.documents.modelsimportQueryType
4
6
fromapproaches.approachimportApproach
5
7
fromtextimportnonewlines
6
8
7
-
# Simple retrieve-then-read implementation, using the Cognitive Search and OpenAI APIs directly. It first retrieves
8
-
# top documents from search, then constructs a prompt with them, and then uses OpenAI to generate an completion
9
-
# (answer) with that prompt.
10
9
classChatReadRetrieveReadApproach(Approach):
10
+
"""
11
+
Simple retrieve-then-read implementation, using the Cognitive Search and OpenAI APIs directly. It first retrieves
12
+
top documents from search, then constructs a prompt with them, and then uses OpenAI to generate an completion
13
+
(answer) with that prompt.
14
+
"""
15
+
11
16
prompt_prefix="""<|im_start|>system
12
17
Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook. Be brief in your answers.
13
18
Answer ONLY with the facts listed in the list of sources below. If there isn't enough information below, say you don't know. Do not generate answers that don't use the sources below. If asking a clarifying question to the user would help, ask the question.
14
19
For tabular information return it as an html table. Do not return markdown format.
15
-
Each source has a name followed by colon and the actual information, always include the source name for each fact you use in the response. Use square brakets to reference the source, e.g. [info1.txt]. Don't combine sources, list each source separately, e.g. [info1.txt][info2.pdf].
20
+
Each source has a name followed by colon and the actual information, always include the source name for each fact you use in the response. Use square brackets to reference the source, e.g. [info1.txt]. Don't combine sources, list each source separately, e.g. [info1.txt][info2.pdf].
0 commit comments