-
Notifications
You must be signed in to change notification settings - Fork 35
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
1 parent
30564f4
commit 3eb9aef
Showing
27 changed files
with
2,572 additions
and
0 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,10 @@ | ||
ARG VARIANT=bullseye | ||
ARG VERSION=3.11 | ||
FROM --platform=amd64 mcr.microsoft.com/devcontainers/python:${VERSION}-${VARIANT} | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y xdg-utils \ | ||
&& curl -fsSL https://aka.ms/install-azd.sh | bash \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* |
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,58 @@ | ||
{ | ||
"name": "Azure Developer CLI", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "bullseye", | ||
"VERSION": "3.11" | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/azure-cli:1": { | ||
"version": "2.48.1" | ||
}, | ||
"ghcr.io/devcontainers/features/docker-from-docker:1": { | ||
"version": "20.10" | ||
}, | ||
"ghcr.io/devcontainers/features/github-cli:1": { | ||
"version": "2" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.azure-dev", | ||
"ms-azuretools.vscode-bicep", | ||
"ms-azuretools.vscode-docker", | ||
"ms-vscode.vscode-node-azure-pack", | ||
"ms-vscode.js-debug", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"ms-azuretools.vscode-azurefunctions", | ||
"github.vscode-github-actions", | ||
"GitHub.copilot-nightly", | ||
"ms-python.black-formatter" | ||
] | ||
}, | ||
"codespaces": { | ||
"openFiles": [ | ||
"main.py" | ||
] | ||
} | ||
}, | ||
"forwardPorts": [ | ||
8000 | ||
], | ||
"postAttachCommand": "", | ||
"postCreateCommand": "pip3 install --user -r requirements.txt", | ||
"remoteUser": "vscode", | ||
"hostRequirements": { | ||
"memory": "8gb", | ||
"cpus": 4 | ||
}, | ||
"portsAttributes": { | ||
"8000": { | ||
"label": "FastAPI Server" | ||
} | ||
} | ||
} |
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,63 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/azure-dev-cli-apps:latest | ||
env: | ||
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | ||
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} | ||
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} | ||
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | ||
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | ||
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in with Azure (Federated Credentials) | ||
if: ${{ env.AZURE_CLIENT_ID != '' }} | ||
run: | | ||
azd auth login ` | ||
--client-id "$Env:AZURE_CLIENT_ID" ` | ||
--federated-credential-provider "github" ` | ||
--tenant-id "$Env:AZURE_TENANT_ID" | ||
shell: pwsh | ||
|
||
- name: Log in with Azure (Client Credentials) | ||
if: ${{ env.AZURE_CREDENTIALS != '' }} | ||
run: | | ||
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable; | ||
Write-Host "::add-mask::$($info.clientSecret)" | ||
azd auth login ` | ||
--client-id "$($info.clientId)" ` | ||
--client-secret "$($info.clientSecret)" ` | ||
--tenant-id "$($info.tenantId)" | ||
shell: pwsh | ||
env: | ||
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Provision Azure Resources - Azure Container Apps, Container Registry, Azure Monitor, Log Analytics | ||
run: azd provision --no-prompt | ||
env: | ||
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} | ||
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | ||
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Deploy changes to Azure Container Apps | ||
run: azd deploy --no-prompt | ||
env: | ||
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} | ||
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} | ||
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} |
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
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 @@ | ||
{ | ||
// 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: FastAPI", | ||
"type": "python", | ||
"request": "launch", | ||
"module": "uvicorn", | ||
"args": [ | ||
"main:app", | ||
"--reload" | ||
], | ||
"jinja": true, | ||
"justMyCode": true | ||
} | ||
] | ||
} |
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,182 @@ | ||
{ | ||
"python.testing.pytestArgs": ["."], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"json.schemas": [ | ||
{ | ||
"fileMatch": ["ai-plugin.json"], | ||
"schema": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"schema_version": { | ||
"type": "string", | ||
"description": "Manifest schema version", | ||
"examples": ["v1"] | ||
}, | ||
"name_for_model": { | ||
"type": "string", | ||
"maxLength": 50, | ||
"pattern": "^[a-zA-Z0-9]*$", | ||
"title": "Name for model", | ||
"description": "Name the model will use to target the plugin (no spaces allowed, only letters and numbers). 50 character max." | ||
}, | ||
"name_for_human": { | ||
"type": "string", | ||
"maxLength": 20, | ||
"description": "Human-readable name, such as the full company name. 20 character max." | ||
}, | ||
"description_for_model": { | ||
"type": "string", | ||
"maxLength": 8000, | ||
"description": "Description better tailored to the model, such as token context length considerations or keyword usage for improved plugin prompting. 8,000 character max." | ||
}, | ||
"description_for_human": { | ||
"type": "string", | ||
"maxLength": 100, | ||
"description": "Human-readable description of the plugin. 100 character max." | ||
}, | ||
"auth": { | ||
"type": "object", | ||
"description": "Authentication schema", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["none"] | ||
} | ||
}, | ||
"required": ["type"] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["service_http"] | ||
}, | ||
"authorization_type": { | ||
"type": "string", | ||
"enum": ["bearer", "basic"] | ||
}, | ||
"verification_tokens": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"type", | ||
"authorization_type", | ||
"verification_tokens" | ||
] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["user_http"] | ||
}, | ||
"authorization_type": { | ||
"type": "string", | ||
"enum": ["bearer", "basic"] | ||
} | ||
}, | ||
"required": ["type", "authorization_type"] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["oauth"] | ||
}, | ||
"client_url": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"scope": { | ||
"type": "string" | ||
}, | ||
"authorization_url": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"authorization_content_type": { | ||
"type": "string" | ||
}, | ||
"verification_tokens": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"type", | ||
"client_url", | ||
"scope", | ||
"authorization_url", | ||
"authorization_content_type", | ||
"verification_tokens" | ||
] | ||
} | ||
] | ||
}, | ||
"api": { | ||
"type": "object", | ||
"description": "API specification", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["openapi"], | ||
"description": "API specification type" | ||
}, | ||
"is_user_authenticated": { | ||
"type": "boolean", | ||
"description": "Indicates whether the user is authenticated" | ||
}, | ||
"url": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "URL of the API specification" | ||
} | ||
}, | ||
"required": ["type", "is_user_authenticated", "url"] | ||
}, | ||
"logo_url": { | ||
"type": "string", | ||
"format": "uri", | ||
"description": "URL used to fetch the logo. Suggested size: 512 x 512. Transparent backgrounds are supported." | ||
}, | ||
"contact_email": { | ||
"type": "string", | ||
"format": "email", | ||
"description": "Email contact for safety/moderation, support, and deactivation" | ||
}, | ||
"legal_info_url": { | ||
"type": "string", | ||
"format": "uri" | ||
} | ||
}, | ||
"required": [ | ||
"schema_version", | ||
"name_for_model", | ||
"name_for_human", | ||
"description_for_model", | ||
"description_for_human", | ||
"auth", | ||
"api", | ||
"logo_url", | ||
"contact_email", | ||
"legal_info_url" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
|
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,2 +1,40 @@ | ||
# adventure-day-agent | ||
This repository host the adventure day agent | ||
|
||
## Quickstart | ||
|
||
``` | ||
# Log in to azd. Only required once per-install. | ||
azd auth login | ||
# Provision and deploy to Azure | ||
azd up | ||
``` | ||
|
||
|
||
## Configure the local env config for testing | ||
|
||
|
||
|
||
## Test API for Challenge 1 | ||
|
||
Go to directory src-agents/challenge1 | ||
|
||
Start up the agent api | ||
``` | ||
uvicorn main:app --reload | ||
``` | ||
|
||
Test the api with: | ||
``` | ||
curl -X 'POST' \ | ||
'http://localhost:8000/ask' \ | ||
-H 'accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"question": "Who is the actor behind iron man? 1. Bill Gates, 2. Robert Downey Jr, 3. Jeff Bezos", | ||
"type": "multiple_choice", | ||
"correlationToken": "fgsdfgsd" | ||
}' | ||
``` |
Oops, something went wrong.