-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
644 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.semantic-kernel/ | ||
local/ | ||
local.settings.json | ||
|
||
bin | ||
obj | ||
csx | ||
.vs | ||
edge | ||
Publish | ||
.vscode/ | ||
.vscode/ | ||
.python_packages/ | ||
.venv/ | ||
.env | ||
__azurite* | ||
.python_packages/ | ||
|
||
*.user | ||
*.suo | ||
*.cscfg | ||
*.Cache | ||
project.lock.json | ||
|
||
/packages | ||
/TestResults | ||
|
||
/tools/NuGet.exe | ||
/App_Data | ||
/secrets | ||
/data | ||
.secrets | ||
appsettings.json | ||
local.settings.json | ||
|
||
node_modules | ||
dist | ||
|
||
# Local python packages | ||
.python_packages/ | ||
|
||
# Python Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Azurite artifacts | ||
__blobstorage__ | ||
__queuestorage__ | ||
__azurite_db*__.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
# Repository setup required :wave: | ||
|
||
Please visit the website URL :point_right: for this repository to complete the setup of this repository and configure access controls. | ||
# gpt on your data orchestrator | ||
|
||
## Quick start - Deploy to Azure | ||
|
||
**1) Pre-reqs** | ||
|
||
- Azure Funcion App | ||
- Cognitive Search Service | ||
- Index created by [ingestion](https://github.com/placerda/gpt-oyd-ingestion) | ||
- CosmosDB Service | ||
- Python and PIP 3 | ||
|
||
**2) Set Application Settings** | ||
|
||
- Rename [local.settings.json.template](local.settings.json.template) to ```local.settings.json``` and update environment variables in this file to run orchestrator locally. | ||
|
||
- In Azure Portal > Function App > Configuration > Application Settings: add the same variables you updated in locall.settings.json. | ||
|
||
**3) Deploy to Azure** | ||
|
||
In VSCode with [Azure Function App Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) go to the *Azure* Window, reveal your Function App in the resource explorer, right-click it then select *Deploy*. | ||
|
||
**3) Deploy locally - optional** | ||
|
||
With Azure Function extension installed you just need to open ```orc/orchestrator.py``` and "Start Debugging" in VSCode. It will start the server in ```http://localhost:7071/api/orc```. | ||
|
||
## Contributing | ||
|
||
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. | ||
|
||
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 | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Trademarks | ||
|
||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft | ||
trademarks or logos is subject to and must follow | ||
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
Any use of third-party trademarks or logos are subject to those third-party's policies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## Getting Started with Azure Function | ||
### Last updated: March 8th 2021 | ||
|
||
#### Project Structure | ||
The main project folder (<project_root>) can contain the following files: | ||
|
||
* **local.settings.json** - Used to store app settings and connection strings when running locally. This file doesn't get published to Azure. To learn more, see [local.settings.file](https://aka.ms/azure-functions/python/local-settings). | ||
* **requirements.txt** - Contains the list of Python packages the system installs when publishing to Azure. | ||
* **host.json** - Contains global configuration options that affect all functions in a function app. This file does get published to Azure. Not all options are supported when running locally. To learn more, see [host.json](https://aka.ms/azure-functions/python/host.json). | ||
* **.vscode/** - (Optional) Contains store VSCode configuration. To learn more, see [VSCode setting](https://aka.ms/azure-functions/python/vscode-getting-started). | ||
* **.venv/** - (Optional) Contains a Python virtual environment used by local development. | ||
* **Dockerfile** - (Optional) Used when publishing your project in a [custom container](https://aka.ms/azure-functions/python/custom-container). | ||
* **tests/** - (Optional) Contains the test cases of your function app. For more information, see [Unit Testing](https://aka.ms/azure-functions/python/unit-testing). | ||
* **.funcignore** - (Optional) Declares files that shouldn't get published to Azure. Usually, this file contains .vscode/ to ignore your editor setting, .venv/ to ignore local Python virtual environment, tests/ to ignore test cases, and local.settings.json to prevent local app settings being published. | ||
|
||
Each function has its own code file and binding configuration file ([**function.json**](https://aka.ms/azure-functions/python/function.json)). | ||
|
||
#### Developing your first Python function using VS Code | ||
|
||
If you have not already, please checkout our [quickstart](https://aka.ms/azure-functions/python/quickstart) to get you started with Azure Functions developments in Python. | ||
|
||
#### Publishing your function app to Azure | ||
|
||
For more information on deployment options for Azure Functions, please visit this [guide](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python#publish-the-project-to-azure). | ||
|
||
#### Next Steps | ||
|
||
* To learn more about developing Azure Functions, please visit [Azure Functions Developer Guide](https://aka.ms/azure-functions/python/developer-guide). | ||
|
||
* To learn more specific guidance on developing Azure Functions with Python, please visit [Azure Functions Developer Python Guide](https://aka.ms/azure-functions/python/python-developer-guide). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"version": "2.0", | ||
"logging": { | ||
"applicationInsights": { | ||
"samplingSettings": { | ||
"isEnabled": true, | ||
"excludedTypes": "Request" | ||
} | ||
} | ||
}, | ||
"extensionBundle": { | ||
"id": "Microsoft.Azure.Functions.ExtensionBundle", | ||
"version": "[3.*, 4.0.0)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"IsEncrypted": false, | ||
"Values": { | ||
"FUNCTIONS_WORKER_RUNTIME": "python", | ||
"AzureWebJobsStorage": "", | ||
|
||
"AZURE_DB_KEY": "", | ||
"AZURE_DB_ID": "", | ||
"AZURE_DB_CONTAINER": "conversations", | ||
|
||
"AZURE_SEARCH_SERVICE": "", | ||
"AZURE_SEARCH_INDEX": "", | ||
"AZURE_SEARCH_KEY": "", | ||
"AZURE_SEARCH_USE_SEMANTIC_SEARCH" : "False", | ||
"AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG" : "default", | ||
"AZURE_SEARCH_TOP_K" : "3", | ||
"AZURE_SEARCH_ENABLE_IN_DOMAIN" : "true", | ||
"AZURE_SEARCH_CONTENT_COLUMNS" : "content", | ||
"AZURE_SEARCH_FILENAME_COLUMN" : "filepath", | ||
"AZURE_SEARCH_TITLE_COLUMN" : "title", | ||
"AZURE_SEARCH_URL_COLUMN" : "url", | ||
|
||
"AZURE_OPENAI_RESOURCE" : "", | ||
"AZURE_OPENAI_KEY": "", | ||
"AZURE_OPENAI_MODEL" : "", | ||
"AZURE_OPENAI_TEMPERATURE" : "", | ||
"AZURE_OPENAI_TOP_P" : "", | ||
"AZURE_OPENAI_MAX_TOKENS" : "", | ||
"AZURE_OPENAI_PREVIEW_API_VERSION" : "2023-06-01-preview", | ||
"AZURE_OPENAI_STREAM" : "false" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import logging | ||
import azure.functions as func | ||
import json | ||
import logging | ||
from . import orchestrator | ||
|
||
def main(req: func.HttpRequest) -> func.HttpResponse: | ||
logging.info('Python HTTP trigger function processed a request.') | ||
|
||
req_body = req.get_json() | ||
conversation_id = req_body.get('conversation_id') | ||
|
||
question = req_body.get('question') | ||
|
||
if question: | ||
result = orchestrator.run(conversation_id, question) | ||
return func.HttpResponse(json.dumps(result), mimetype="application/json", status_code=200) | ||
else: | ||
return func.HttpResponse('{"error": "no question found in json input"}', mimetype="application/json", status_code=200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"scriptFile": "__init__.py", | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get", | ||
"post" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "$return" | ||
} | ||
] | ||
} |
Oops, something went wrong.