Skip to content

Commit 197977b

Browse files
authored
Merge pull request #127 from Azure-Samples/generate-error
Deprecate azure-ai-generative partially
2 parents eda44cc + f12f0c7 commit 197977b

File tree

2 files changed

+9
-40
lines changed

2 files changed

+9
-40
lines changed

README.md

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ We recommend at least 200 QA pairs if possible.
105105
There are a few ways to get this data:
106106
107107
1. Manually curate a set of questions and answers that you consider to be ideal. This is the most accurate, but also the most time-consuming. Make sure your answers include citations in the expected format. This approach requires domain expertise in the data.
108-
2. Use the generator script to generate a set of questions and answers. This is the fastest, but may also be the least accurate. See below for details on how to run the generator script.
109-
3. Use the generator script to generate a set of questions and answers, and then manually curate them, rewriting any answers that are subpar and adding missing citations. This is a good middle ground, and is what we recommend.
108+
2. Use a generator script to generate a set of questions and answers, and use them directly. This is the fastest, but may also be the least accurate.
109+
3. Use a generator script to generate a set of questions and answers, and then manually curate them, rewriting any answers that are subpar and adding missing citations. This is a good middle ground, and is what we recommend.
110110
111111
<details>
112112
<summary>Additional tips for ground truth data generation</summary>
@@ -117,43 +117,6 @@ There are a few ways to get this data:
117117

118118
</details>
119119

120-
### Running the generator script
121-
122-
This repo includes a script for generating questions and answers from documents stored in Azure AI Search.
123-
124-
> [!IMPORTANT]
125-
> The generator script can only generate English Q/A pairs right now, due to [limitations in the azure-ai-generative SDK](https://github.com/Azure/azure-sdk-for-python/issues/34099).
126-
127-
1. Create `.env` file by copying `.env.sample`
128-
2. Fill in the values for your Azure AI Search instance:
129-
130-
```shell
131-
AZURE_SEARCH_ENDPOINT="https://<service-name>.search.windows.net"
132-
AZURE_SEARCH_INDEX="<index-name>"
133-
AZURE_SEARCH_KEY=""
134-
```
135-
136-
The key may not be necessary if it's configured for keyless access from your account.
137-
If providing a key, it's best to provide a query key since the script only requires that level of access.
138-
139-
3. Run the generator script:
140-
141-
```shell
142-
python -m evaltools generate --output=example_input/qa.jsonl --persource=5 --numquestions=200
143-
```
144-
145-
That script will generate 200 questions and answers, and store them in `example_input/qa.jsonl`. We've already provided an example based off the sample documents for this app.
146-
147-
To further customize the generator beyond the `numquestions` and `persource` parameters, modify `scripts/generate.py`.
148-
149-
Optional:
150-
151-
By default this script assumes your index citation field is named `sourcepage`, if your search index contains a different citation field name use the `citationfieldname` option to specify the correct name
152-
153-
```shell
154-
python -m evaltools generate --output=example_input/qa.jsonl --persource=5 --numquestions=200 --citationfieldname=filepath
155-
```
156-
157120
## Running an evaluation
158121

159122
We provide a script that loads in the current `azd` environment's variables, installs the requirements for the evaluation, and runs the evaluation against the local app. Run it like this:

src/evaltools/gen/generate.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from collections.abc import Generator
66
from pathlib import Path
77

8-
from azure.ai.generative.synthetic.qa import QADataGenerator, QAType
98
from azure.search.documents import SearchClient
109

1110
from evaltools import service_setup
@@ -22,6 +21,13 @@ def generate_test_qa_data(
2221
source_to_text: callable,
2322
answer_formatter: callable,
2423
):
24+
try:
25+
from azure.ai.generative.synthetic.qa import QADataGenerator, QAType
26+
except ImportError:
27+
logger.error(
28+
"Azure AI Generative package is deprecated and no longer working, so this functionality is disabled."
29+
)
30+
2531
logger.info(
2632
"Generating %d questions total, %d per source, based on search results",
2733
num_questions_total,

0 commit comments

Comments
 (0)