Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synch #2

Merged
merged 23 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a4d9386
Allow public documents when authentication is enabled (#1576)
mattgotteiner May 15, 2024
4eeb443
Optional deployment of Private Networks, Private Endpoints plus optio…
tonybaloney May 15, 2024
7366e50
set default key for retrieval mode (#1609)
john0isaac May 15, 2024
3822c52
Additional pointers to docs on private endpoints and load balancing (…
pamelafox May 15, 2024
a74df4e
Removing unneeded key for free search service (#1620)
pamelafox May 16, 2024
414b1a9
Bump the python-requirements group across 1 directory with 65 updates…
dependabot[bot] May 17, 2024
b31a95b
Load testing for vision (#1633)
pamelafox May 20, 2024
bb0c3ed
Fix samples browser (#1631)
diberry May 20, 2024
e6fa39f
Fix samples browser - bookmarks (#1637)
diberry May 20, 2024
77303da
Improve token counting for messages with package (#1577)
pamelafox May 21, 2024
0196e73
Fix output variable for global document access (#1645)
mattgotteiner May 23, 2024
c6b8c6e
Updates to login docs (login step, Entra branding) (#1574)
pamelafox May 28, 2024
f11423a
Disable local auth for Azure DI (#1629)
pamelafox May 28, 2024
8cd3055
Update cognitiveservices.bicep for bypass (#1657)
pamelafox May 29, 2024
7f3efe5
GPt4 version (#1663)
pamelafox May 29, 2024
69b6e8a
Use chat model for query rewriting (#1659)
pamelafox May 29, 2024
7ffcb3b
Add speech recognizer and synthesis on browser interface (#113)
sowu880 May 30, 2024
23d2e38
Fix overlap percentage calculation (#1668)
bastbu May 31, 2024
f16c26b
Bump the python-requirements group across 1 directory with 17 updates…
dependabot[bot] May 31, 2024
a5c4cce
Use gpt-4o for vision approach (#1656)
pamelafox Jun 3, 2024
938c674
Update productionizing.md (#1677)
simonkurtz-MSFT Jun 3, 2024
f80a3db
Enable diagnostics for search service (#1676)
pamelafox Jun 3, 2024
306ac38
feat: add low cost browser text to speech output using WebSpeechAPI (…
john0isaac Jun 3, 2024
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
9 changes: 9 additions & 0 deletions .azdo/pipelines/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,18 @@ steps:
AZURE_COMPUTER_VISION_RESOURCE_GROUP: $(AZURE_COMPUTER_VISION_RESOURCE_GROUP)
AZURE_COMPUTER_VISION_LOCATION: $(AZURE_COMPUTER_VISION_LOCATION)
AZURE_COMPUTER_VISION_SKU: $(AZURE_COMPUTER_VISION_SKU)
USE_SPEECH_INPUT_BROWSER: $(USE_SPEECH_INPUT_BROWSER)
USE_SPEECH_OUTPUT_BROWSER: $(USE_SPEECH_OUTPUT_BROWSER)
USE_SPEECH_OUTPUT_AZURE: $(USE_SPEECH_OUTPUT_AZURE)
AZURE_SPEECH_SERVICE: $(AZURE_SPEECH_SERVICE)
AZURE_SPEECH_SERVICE_RESOURCE_GROUP: $(AZURE_SPEECH_SERVICE_RESOURCE_GROUP)
AZURE_SPEECH_SERVICE_LOCATION: $(AZURE_SPEECH_SERVICE_LOCATION)
AZURE_SPEECH_SERVICE_SKU: $(AZURE_SPEECH_SERVICE_SKU)
AZURE_KEY_VAULT_NAME: $(AZURE_KEY_VAULT_NAME)
AZURE_USE_AUTHENTICATION: $(AZURE_USE_AUTHENTICATION)
AZURE_ENFORCE_ACCESS_CONTROL: $(AZURE_ENFORCE_ACCESS_CONTROL)
AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS: $(AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS)
AZURE_ENABLE_UNAUTHENTICATED_ACCESS: $(AZURE_ENABLE_UNAUTHENTICATED_ACCESS)
AZURE_TENANT_ID: $(AZURE_TENANT_ID)
AZURE_AUTH_TENANT_ID: $(AZURE_AUTH_TENANT_ID)
AZURE_SERVER_APP_ID: $(AZURE_SERVER_APP_ID)
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,18 @@ jobs:
USE_GPT4V: ${{ vars.USE_GPT4V }}
AZURE_VISION_ENDPOINT: ${{ vars.AZURE_VISION_ENDPOINT }}
VISION_SECRET_NAME: ${{ vars.VISION_SECRET_NAME }}
USE_SPEECH_INPUT_BROWSER: ${{ vars.USE_SPEECH_INPUT_BROWSER }}
USE_SPEECH_OUTPUT_BROWSER: ${{ vars.USE_SPEECH_OUTPUT_BROWSER }}
USE_SPEECH_OUTPUT_AZURE: ${{ vars.USE_SPEECH_OUTPUT_AZURE }}
AZURE_SPEECH_SERVICE: ${{ vars.AZURE_SPEECH_SERVICE }}
AZURE_SPEECH_SERVICE_RESOURCE_GROUP: ${{ vars.AZURE_SPEECH_RESOURCE_GROUP }}
AZURE_SPEECH_SERVICE_LOCATION: ${{ vars.AZURE_SPEECH_SERVICE_LOCATION }}
AZURE_SPEECH_SERVICE_SKU: ${{ vars.AZURE_SPEECH_SERVICE_SKU }}
AZURE_KEY_VAULT_NAME: ${{ vars.AZURE_KEY_VAULT_NAME }}
AZURE_USE_AUTHENTICATION: ${{ vars.AZURE_USE_AUTHENTICATION }}
AZURE_ENFORCE_ACCESS_CONTROL: ${{ vars.AZURE_ENFORCE_ACCESS_CONTROL }}
AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS: ${{ vars.AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS }}
AZURE_ENABLE_UNAUTHENTICATED_ACCESS: ${{ vars.AZURE_ENABLE_UNAUTHENTICATED_ACCESS }}
AZURE_AUTH_TENANT_ID: ${{ vars.AZURE_AUTH_TENANT_ID }}
AZURE_SERVER_APP_ID: ${{ vars.AZURE_SERVER_APP_ID }}
AZURE_CLIENT_APP_ID: ${{ vars.AZURE_CLIENT_APP_ID }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ jobs:
id: e2e
if: runner.os != 'Windows'
run: |
playwright install --with-deps
playwright install chromium --with-deps
python3 -m pytest tests/e2e.py --tracing=retain-on-failure
- name: Upload test artifacts
if: ${{ failure() && steps.e2e.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces
name: playwright-traces${{ matrix.python_version }}
path: test-results
123 changes: 65 additions & 58 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
Expand All @@ -12,122 +12,129 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

- [Code of Conduct](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submitting a PR](#submit-pr)
- [Running Tests](#tests)
- [Code Style](#style)
- [Code of Conduct](#code-of-conduct)
- [Found an Issue?](#found-an-issue)
- [Want a Feature?](#want-a-feature)
- [Submission Guidelines](#submission-guidelines)
- [Submitting an Issue](#submitting-an-issue)
- [Submitting a Pull Request (PR)](#submitting-a-pull-request-pr)
- [Setting up the development environment](#setting-up-the-development-environment)
- [Running unit tests](#running-unit-tests)
- [Running E2E tests](#running-e2e-tests)
- [Code Style](#code-style)

## Code of Conduct

## <a name="coc"></a> Code of Conduct
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

## <a name="issue"></a> Found an Issue?
## Found an Issue?

If you find a bug in the source code or a mistake in the documentation, you can help us by
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.
[submitting an issue](#submitting-an-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submitting-a-pull-request-pr) with a fix.

## Want a Feature?

## <a name="feature"></a> Want a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
You can *request* a new feature by [submitting an issue](#submitting-an-issue) to the GitHub
Repository. If you would like to *implement* a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.

* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submitting-a-pull-request-pr).

## <a name="submit"></a> Submission Guidelines
## Submission Guidelines

### Submitting an Issue

### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, search the archive, maybe your question was already answered.

If your issue appears to be a bug, and hasn't been reported, open a new issue.
Help us to maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues. Providing the following information will increase the
chances of your issue being dealt with quickly:

* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
* **Version** - what version is affected (e.g. 0.1.2)
* **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
* **Browsers and Operating System** - is this a problem with all browsers?
* **Reproduce the Error** - provide a live example or a unambiguous set of steps
* **Related Issues** - has a similar issue been reported before?
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
- **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
- **Version** - what version is affected (e.g. 0.1.2)
- **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
- **Browsers and Operating System** - is this a problem with all browsers?
- **Reproduce the Error** - provide a live example or a unambiguous set of steps
- **Related Issues** - has a similar issue been reported before?
- **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)

You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new].
You can file new issues by providing the above information at the corresponding repository's issues link: <https://github.com/[organization-name>]/[repository-name]/issues/new].

### Submitting a Pull Request (PR)

### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:

* Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR
- Search the repository (<https://github.com/[organization-name>]/[repository-name]/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.
* Make your changes in a new git fork
* Follow [Code style conventions](#style)
* [Run the tests](#tests) (and write new ones, if needed)
* Commit your changes using a descriptive commit message
* Push your fork to GitHub
* In GitHub, create a pull request to the `main` branch of the repository
* Ask a maintainer to review your PR and address any comments they might have
- Make your changes in a new git fork
- Follow [Code style conventions](#code-style)
- [Run the tests](#running-unit-tests) (and write new ones, if needed)
- Commit your changes using a descriptive commit message
- Push your fork to GitHub
- In GitHub, create a pull request to the `main` branch of the repository
- Ask a maintainer to review your PR and address any comments they might have

## <a name="tests"></a> Setting up the development environment
## Setting up the development environment

Install the development dependencies:

```
python3 -m pip install -r requirements-dev.txt
```shell
python -m pip install -r requirements-dev.txt
```

Install the pre-commit hooks:

```
```shell
pre-commit install
```

Compile the JavaScript:

```
```shell
( cd ./app/frontend ; npm install ; npm run build )
```

## <a name="unit-tests"></a> Running unit tests
## Running unit tests

Run the tests:

```
python3 -m pytest
```shell
python -m pytest
```

Check the coverage report to make sure your changes are covered.

```shell
python -m pytest --cov
```
python3 -m pytest --cov
```

## <a name="e2e-tests"></a> Running E2E tests

## Running E2E tests

Install Playwright browser dependencies:

```
```shell
playwright install --with-deps
```

Run the tests:

```
python3 -m pytest tests/e2e.py --tracing=retain-on-failure
```shell
python -m pytest tests/e2e.py --tracing=retain-on-failure
```

When a failure happens, the trace zip will be saved in the test-results folder.
You can view that using the Playwright CLI:

```
```shell
playwright show-trace test-results/<trace-zip>
```

You can also use the online trace viewer at https://trace.playwright.dev/
You can also use the online trace viewer at <https://trace.playwright.dev/>


## <a name="style"></a> Code Style
## Code Style

This codebase includes several languages: TypeScript, Python, Bicep, Powershell, and Bash.
Code should follow the standard conventions of each language.
Expand All @@ -136,20 +143,20 @@ For Python, you can enforce the conventions using `ruff` and `black`.

Install the development dependencies:

```
python3 -m pip install -r requirements-dev.txt
```shell
python -m pip install -r requirements-dev.txt
```

Run `ruff` to lint a file:

```
python3 -m ruff <path-to-file>
```shell
python -m ruff <path-to-file>
```

Run `black` to format a file:

```
python3 -m black <path-to-file>
```shell
python -m black <path-to-file>
```

If you followed the steps above to install the pre-commit hooks, then you can just wait for those hooks to run `ruff` and `black` for you.
31 changes: 8 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
---
name: ChatGPT + Enterprise data
description: Chat with your data using OpenAI and AI Search.
languages:
- python
- typescript
- bicep
- azdeveloper
products:
- azure-openai
- azure-cognitive-search
- azure-app-service
- azure
page_type: sample
urlFragment: azure-search-openai-demo
---

# ChatGPT + Enterprise data with Azure OpenAI and AI Search

> [!IMPORTANT]
Expand Down Expand Up @@ -44,7 +27,6 @@ urlFragment: azure-search-openai-demo
- [Troubleshooting](#troubleshooting)
- [Resources](#resources)


[![Open in GitHub Codespaces](https://img.shields.io/static/v1?style=for-the-badge&label=GitHub+Codespaces&message=Open&color=brightgreen&logo=github)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=599293758&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=WestUs2)
[![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/azure-samples/azure-search-openai-demo)

Expand All @@ -56,11 +38,14 @@ The repo includes sample data so it's ready to try end to end. In this sample ap

## Features

* Chat and Q&A interfaces
* Explores various options to help users evaluate the trustworthiness of responses with citations, tracking of source content, etc.
* Shows possible approaches for data preparation, prompt construction, and orchestration of interaction between model (OpenAI) and retriever (AI Search)
* Settings directly in the UX to tweak the behavior and experiment with options
* Performance tracing and monitoring with Application Insights
- Chat (multi-turn) and Q&A (single turn) interfaces
- Renders citations and thought process for each answer
- Includes settings directly in the UI to tweak the behavior and experiment with options
- Integrates Azure AI Search for indexing and retrieval of documents, with support for [many document formats](/docs/data_ingestion.md#supported-document-formats) as well as [integrated vectorization](/docs/data_ingestion.md#overview-of-integrated-vectorization)
- Optional usage of [GPT-4 with vision](/docs/gpt4vision.md) to reason over image-heavy documents
- Optional addition of [speech input/output](/docs/deploy_features.md#enabling-speech-inputoutput) for accessibility
- Optional automation of [user login and data access](/docs/login_and_acl.md) via Microsoft Entra
- Performance tracing and monitoring with Application Insights

![Chat screen](docs/images/chatscreen.png)

Expand Down
Loading
Loading