Skip to content

Commit

Permalink
Merge main updates (nov 1) (#198)
Browse files Browse the repository at this point in the history
* Add Tracing (#175)

* fix evaluations

* Configure Azure Developer Pipeline

* remove env var from chat.prompty

* Configure Azure Developer Pipeline

* add prompty endpoint it chat, and remove unused vars in gh action

* update chat.prompty

* fix docker file for devcontainer

* add all env vars to gha

* tracing updates

* Configure Azure Developer Pipeline

* AI Tour / docs fix v4 (#186)

* aitour-docs-fix-v4 / clear inputs on notebooks

* docs ds-refresh

* updated / evaluation docs

* fixed / typos

* Udpdated README.md to reflect azd Guidance (#192)

* Docs/oct updates v2 (#193)

* docs / refactored

Move versions to docs/workshop, keep core README in sync with docs/README for Samples browser.

* fix / docs for clarity

* fix app insights connection (#195)

* Move ACA build to azd (#196)

* Move ACA build to azd

* fix/ service naming

---------

Co-authored-by: Cassie Breviu <46505951+cassiebreviu@users.noreply.github.com>
  • Loading branch information
nitya and cassiebreviu authored Nov 1, 2024
1 parent 24c79d8 commit b676236
Show file tree
Hide file tree
Showing 32 changed files with 223,886 additions and 431 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN sudo apt-get update && sudo apt-get install -y \
# Install keyring-related and IPython packages in the same layer to reduce the image size and build time
COPY ./src/api/requirements.txt .
RUN pip install -r requirements.txt \
&& pip install keyrings.alt dbus-python ipython ipykernel mkdocs-material
&& pip install keyrings.alt dbus-python ipython ipykernel mkdocs-material

# Configure the IPython kernel
RUN ipython kernel install --name "python3" --user
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/evaluations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ jobs:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
APPINSIGHTS_CONNECTIONSTRING: ${{ vars.APPINSIGHTS_CONNECTIONSTRING }}
AZURE_CONTAINER_ENVIRONMENT_NAME: ${{ vars.AZURE_CONTAINER_ENVIRONMENT_NAME }}
AZURE_CONTAINER_REGISTRY_ENDPOINT: ${{ vars.AZURE_CONTAINER_REGISTRY_ENDPOINT }}
AZURE_CONTAINER_REGISTRY_NAME: ${{ vars.AZURE_CONTAINER_REGISTRY_NAME }}
AZURE_COSMOS_NAME: ${{ vars.AZURE_COSMOS_NAME }}
AZURE_EMBEDDING_NAME: ${{ vars.AZURE_EMBEDDING_NAME }}
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }}
AZURE_OPENAI_CHAT_DEPLOYMENT: ${{ vars.AZURE_OPENAI_CHAT_DEPLOYMENT }}
AZURE_OPENAI_NAME: ${{ vars.AZURE_OPENAI_NAME }}
AZURE_OPENAI_RESOURCE_GROUP_LOCATION: ${{ vars.AZURE_OPENAI_RESOURCE_GROUP_LOCATION }}
AZURE_SEARCH_ENDPOINT: ${{ vars.AZURE_SEARCH_ENDPOINT }}
AZURE_SEARCH_NAME: ${{ vars.AZURE_SEARCH_NAME }}
COSMOS_CONTAINER: ${{ vars.COSMOS_CONTAINER }}
COSMOS_ENDPOINT: ${{ vars.COSMOS_ENDPOINT }}
OPENAI_TYPE: ${{ vars.OPENAI_TYPE }}
SERVICE_ACA_IMAGE_NAME: ${{ vars.SERVICE_ACA_IMAGE_NAME }}
SERVICE_ACA_NAME: ${{ vars.SERVICE_ACA_NAME }}
SERVICE_ACA_URI: ${{ vars.SERVICE_ACA_URI }}

steps:
- name: checkout repo content
uses: actions/checkout@v4 # checkout the repository content
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ src/api/result.jsonl
src/api/eval_results.jsonl
src/api/eval_results.md
docs/workshop/site
sandbox/*
sandbox/*
docs/workshop/docs/.DS_Store
177 changes: 101 additions & 76 deletions README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions azure.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: contoso-chat-openai-prompty
metadata:
template: contoso-chat-openai-prompty@0.0.1
services:
aca:
project: ./src/api
language: python
host: containerapp
docker:
remoteBuild: true
hooks:
postprovision:
posix:
Expand Down
63 changes: 8 additions & 55 deletions data/customer_info/create-cosmos-db.ipynb

Large diffs are not rendered by default.

54 changes: 6 additions & 48 deletions data/product_info/create-azure-search.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"import os\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -206,19 +195,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"deleting index contoso-products\n",
"creating index contoso-products\n",
"index contoso-products created\n"
]
}
],
"outputs": [],
"source": [
"contoso_search = os.environ[\"AZURE_SEARCH_ENDPOINT\"]\n",
"index_name = \"contoso-products\"\n",
Expand All @@ -236,30 +215,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"indexing documents\n"
]
},
{
"ename": "OpenAIError",
"evalue": "Missing credentials. Please pass one of `api_key`, `azure_ad_token`, `azure_ad_token_provider`, or the `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN` environment variables.",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mOpenAIError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[6], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindexing documents\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m docs \u001b[38;5;241m=\u001b[39m \u001b[43mgen_contoso_products\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mproducts.csv\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# Upload our data to the index.\u001b[39;00m\n\u001b[0;32m 4\u001b[0m search_client \u001b[38;5;241m=\u001b[39m SearchClient(\n\u001b[0;32m 5\u001b[0m endpoint\u001b[38;5;241m=\u001b[39mcontoso_search,\n\u001b[0;32m 6\u001b[0m index_name\u001b[38;5;241m=\u001b[39mindex_name,\n\u001b[0;32m 7\u001b[0m credential\u001b[38;5;241m=\u001b[39mDefaultAzureCredential(),\n\u001b[0;32m 8\u001b[0m )\n",
"Cell \u001b[1;32mIn[4], line 8\u001b[0m, in \u001b[0;36mgen_contoso_products\u001b[1;34m(path)\u001b[0m\n\u001b[0;32m 5\u001b[0m openai_deployment \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext-embedding-ada-002\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 7\u001b[0m \u001b[38;5;66;03m# openai.Embedding.create() -> client.embeddings.create()\u001b[39;00m\n\u001b[1;32m----> 8\u001b[0m client \u001b[38;5;241m=\u001b[39m \u001b[43mAzureOpenAI\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 9\u001b[0m \u001b[43m \u001b[49m\u001b[43mapi_version\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m2023-07-01-preview\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 10\u001b[0m \u001b[43m \u001b[49m\u001b[43mazure_endpoint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mopenai_service_endoint\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 11\u001b[0m \u001b[43m \u001b[49m\u001b[43mazure_deployment\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mopenai_deployment\u001b[49m\n\u001b[0;32m 12\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 14\u001b[0m products \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(path)\n\u001b[0;32m 15\u001b[0m items \u001b[38;5;241m=\u001b[39m []\n",
"File \u001b[1;32me:\\github\\azure-samples\\contoso-chat-1\\.venv\\Lib\\site-packages\\openai\\lib\\azure.py:169\u001b[0m, in \u001b[0;36mAzureOpenAI.__init__\u001b[1;34m(self, api_version, azure_endpoint, azure_deployment, api_key, azure_ad_token, azure_ad_token_provider, organization, project, base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation)\u001b[0m\n\u001b[0;32m 166\u001b[0m azure_ad_token \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39menviron\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAZURE_OPENAI_AD_TOKEN\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 168\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m api_key \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m azure_ad_token \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m azure_ad_token_provider \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 169\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m OpenAIError(\n\u001b[0;32m 170\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMissing credentials. Please pass one of `api_key`, `azure_ad_token`, `azure_ad_token_provider`, or the `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN` environment variables.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 171\u001b[0m )\n\u001b[0;32m 173\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m api_version \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 174\u001b[0m api_version \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39menviron\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOPENAI_API_VERSION\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"\u001b[1;31mOpenAIError\u001b[0m: Missing credentials. Please pass one of `api_key`, `azure_ad_token`, `azure_ad_token_provider`, or the `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN` environment variables."
]
}
],
"outputs": [],
"source": [
"print(f\"indexing documents\")\n",
"docs = gen_contoso_products(\"products.csv\")\n",
Expand Down
Loading

0 comments on commit b676236

Please sign in to comment.