Skip to content

Commit 82522fb

Browse files
authored
Document how to make settings permanent (#955)
1 parent 8719f07 commit 82522fb

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

docs/customization.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The chat tab uses the approach programmed in [chatreadretrieveread.py](https://g
3333

3434
The `system_message_chat_conversation` variable is currently tailored to the sample data since it starts with "Assistant helps the company employees with their healthcare plan questions, and questions about the employee handbook." Change that to match your data.
3535

36-
### Ask approach
36+
#### Ask approach
3737

3838
The ask tab uses the approach programmed in [retrievethenread.py](https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/app/backend/approaches/retrievethenread.py).
3939

@@ -42,6 +42,33 @@ The ask tab uses the approach programmed in [retrievethenread.py](https://github
4242

4343
The `system_chat_template` variable is currently tailored to the sample data since it starts with "You are an intelligent assistant helping Contoso Inc employees with their healthcare plan questions and employee handbook questions." Change that to match your data.
4444

45+
#### Making settings overrides permanent
46+
47+
The UI provides a "Developer Settings" menu for customizing the approaches, like disabling semantic ranker or using vector search.
48+
Those settings are passed in the "context" field of the request to the backend, and are not saved permanently.
49+
However, if you find a setting that you do want to make permanent, there are two approaches:
50+
51+
1. Change the defaults in the frontend. You'll find the defaults in `Chat.tsx` and `OneShot.tsx` (for Ask). For example, this line of code sets the default retrieval mode to Hybrid:
52+
53+
```typescript
54+
const [retrievalMode, setRetrievalMode] = useState<RetrievalMode>(RetrievalMode.Hybrid);
55+
```
56+
57+
You can change the default to Text by changing the code to:
58+
59+
```typescript
60+
const [retrievalMode, setRetrievalMode] = useState<RetrievalMode>(RetrievalMode.Text);
61+
```
62+
63+
2. Change the overrides in the backend. Each of the approaches has a `run` method that takes a `context` parameter, and the first line of code extracts the overrides from that `context`. That's where you can override any of the settings. For example, to change the retrieval mode to text:
64+
65+
```python
66+
overrides = context.get("overrides", {})
67+
overrides["retrieval_mode"] = "text"
68+
```
69+
70+
By changing the setting on the backend, you can safely remove the Developer Settings UI from the frontend, if you don't wish to expose that to your users.
71+
4572
## Improving answer quality
4673

4774
Once you are running the chat app on your own data and with your own tailored system prompt,

0 commit comments

Comments
 (0)