Skip to content

Commit

Permalink
First commit for sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
pablocastro committed Mar 9, 2023
1 parent 69d24f0 commit 3cd9ae4
Show file tree
Hide file tree
Showing 92 changed files with 7,222 additions and 37 deletions.
21 changes: 19 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Azure az webapp deployment details
.azure

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -20,7 +23,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -50,6 +52,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,6 +75,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -82,7 +86,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -127,3 +133,14 @@ dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# NPM
npm-debug.log*
node_modules
static/
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"ms-azuretools.azure-dev"
]
}
60 changes: 60 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"cwd": "${workspaceFolder}/app/backend",
"env": {
"FLASK_APP": "app.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"-p 5000"
],
"console": "integratedTerminal",
"justMyCode": true,
"envFile": "${input:dotEnvFilePath}",
},
{
"name": "Frontend: watch",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/app/frontend",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"watch"
],
"console": "integratedTerminal",
},
{
"name": "Frontend: build",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/app/frontend",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"build"
],
"console": "integratedTerminal",
}
],
"inputs": [
{
"id": "dotEnvFilePath",
"type": "command",
"command": "azure-dev.commands.getDotEnvFilePath"
}
]
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"search.exclude": {
"**/node_modules": true,
"static": true
}
}
32 changes: 32 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start App",
"type": "dotenv",
"targetTasks": [
"Start App (Script)"
],
"file": "${input:dotEnvFilePath}"
},
{
"label": "Start App (Script)",
"type": "shell",
"command": "start.cmd",
"presentation": {
"reveal": "silent"
},
"options": {
"cwd": "${workspaceFolder}/app"
},
"problemMatcher": []
}
],
"inputs": [
{
"id": "dotEnvFilePath",
"type": "command",
"command": "azure-dev.commands.getDotEnvFilePath"
}
]
}
72 changes: 37 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
# Project Name
# ChatGPT + Enterprise data with Azure OpenAI and Cognitive Search

(short, 1-3 sentenced, description of the project)
This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data. It uses Azure OpenAI Service to access the ChatGPT model (gpt-35-turbo), and Azure Cognitive Search for data indexing and retrieval.

## Features
The repo includes sample data so it's ready to try end to end. In this sample application we use a fictitious company called Contoso Electronics, and the experience allows its employees to ask questions about the benefits, internal policies, as well as job descriptions and roles.

This project framework provides the following features:
## Features

* Feature 1
* Feature 2
* ...
* 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 (ChatGPT) and retriever (Cognitive Search)
* Settings directly in the UX to tweak the behavior and experiment with options

## Getting Started

### Prerequisites
** NOTE ** In order to deploy and run this example, you'll need an Azure subscription with access enabled for the Azure OpenAI service. You can request access [here](https://aka.ms/oaiapply).

(ideally very short, if any)
### Prerequisites

- OS
- Library version
- ...
- Azure Developer CLI (install from [here](https://aka.ms/azure-dev/install))
- Python (install from [here](https://www.python.org/downloads/))
- **Imporant**: Python and the pip package manager must in the path in Windows for the setup scripts to work.
- Node.js (install from [here](https://nodejs.org/en/download/))
- Git (install from [here](https://git-scm.com/downloads))
- Powershell (pwsh) (install from [here](https://learn.microsoft.com/en-us/powershell/))

### Installation

(ideally very short)
Starting from scratch:
1. Create a new folder and switch to it in the terminal
2. Run "azd up -t azure-search-openai-demo"
* 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)

- npm install [package name]
- mvn install
- ...
Deploying or re-deploying a local clone of the repo:
* Simply run "azd up"

### Quickstart
(Add steps to get up and running quickly)
Running locally:
* Run `./app/start.cmd` or run the "VS Code Task: Start App" to start the project locally.

1. git clone [repository clone url]
2. cd [repository name]
3. ...
** AZURE RESOURCE COSTS ** by default this sample will create Azure App Service and Azure Cognitive Search resources that have a monthly cost. You can switch them to free versions of each of them if you want to avoid this cost by changing the parameters file under the infra folder (though there are some limits to consider; for example, you can have up to 1 free Cognitive Search resource per subscription.)

### Quickstart

## Demo

A demo app is included to show how to use the project.

To run the demo, follow these steps:

(Add steps to start up the demo)
* In Azure: navigate to the Azure WebApp deployed by azd. The URL is printed out when azd completes (as "Endpoint"), or you can find it in the Azure portal.
* Running locally: navigate to 127.0.0.1:5000

1.
2.
3.
Once in the web app:
* Try different topics in chat or Q&A context. For chat, try follow up questions, clarifications, ask to simplify or elaborate on answer, etc.
* Explore citations and sources
* Click on "settings" to try different options, tweak prompts, etc.

## Resources

(Any additional resources or related projects)
* [Revolutionize your Enterprise Data with ChatGPT: Next-gen Apps w/ Azure OpenAI and Cognitive Search](https://aka.ms/entgptsearchblog)
* [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search)
* [Azure OpenAI Service](https://learn.microsoft.com/azure/cognitive-services/openai/overview)

- Link to supporting information
- Link to similar sample
- ...
### Note
>Note: The PDF documents used in this demo contain information generated using a language model (Azure OpenAI Service). The information contained in these documents is only for demonstration purposes and does not reflect the opinions or beliefs of Microsoft. Microsoft makes no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information contained in this document. All rights reserved to Microsoft.
Loading

0 comments on commit 3cd9ae4

Please sign in to comment.