Skip to content

Commit 1a95a85

Browse files
committed
add base solution
1 parent 267dd3b commit 1a95a85

33 files changed

+6222
-0
lines changed

.amlignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!.env
2+
.venv
3+
.mypy_cache
4+
.pytest_cache
5+
.ruff_cache
6+
*.log
7+
tests
8+
data
9+
notebooks

.devcontainer/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM python:3.12.7
2+
ARG USERNAME=vscode
3+
ARG USER_UID=1010
4+
ARG USER_GID=$USER_UID
5+
6+
# Set the working directory inside the container
7+
WORKDIR /workspace
8+
9+
ENV PIP_NO_CACHE_DIR=off \
10+
POETRY_NO_INTERACTION=1 \
11+
POETRY_VIRTUALENVS_CREATE=false \
12+
POETRY_HOME='/usr/local' \
13+
POETRY_VERSION=1.8.3 \
14+
PYTHON_VERSION=3.12.7
15+
16+
# Install required tools and dependencies
17+
RUN apt-get update && apt-get install -y \
18+
sudo \
19+
wget \
20+
curl \
21+
gcc \
22+
ca-certificates \
23+
build-essential \
24+
libssl-dev \
25+
zlib1g-dev \
26+
libbz2-dev \
27+
libreadline-dev \
28+
libffi-dev \
29+
llvm \
30+
xz-utils \
31+
git \
32+
libsqlite3-dev \
33+
pre-commit \
34+
&& curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 \
35+
&& apt-get clean -y \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
# Create a user with sudo privileges
39+
RUN groupadd --gid $USER_GID $USERNAME \
40+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
41+
&& mkdir -p /etc/sudoers.d \
42+
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
43+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
44+
&& chown -R $USERNAME $POETRY_HOME
45+
46+
USER $USERNAME
47+
48+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
49+
# Install Azure CLI
50+
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash \
51+
&& az extension add --name ml
52+
53+
# Copy and install dependencies
54+
COPY poetry.lock pyproject.toml ./
55+
RUN poetry install

.devcontainer/devcontainer.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "Data Synthesizer Dev Container",
3+
"build": {
4+
"context": "..",
5+
"dockerfile": "Dockerfile"
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
9+
"ghcr.io/dhoeric/features/hadolint:1": {},
10+
"ghcr.io/devcontainers/features/common-utils:2": {
11+
"installZsh": true,
12+
"configureZshAsDefaultShell": true,
13+
"installOhMyZsh": true,
14+
"upgradePackages": false,
15+
"username": "vscode"
16+
}
17+
},
18+
"runArgs": [
19+
"--env-file",
20+
".env"
21+
],
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"codezombiech.gitignore",
26+
"exiasr.hadolint",
27+
"ms-python.python",
28+
"njpwerner.autodocstring",
29+
"shardulm94.trailing-spaces",
30+
"DavidAnson.vscode-markdownlint",
31+
"ms-python.mypy-type-checker",
32+
"ms-vsliveshare.vsliveshare",
33+
"redhat.vscode-yaml",
34+
"streetsidesoftware.code-spell-checker",
35+
"timonwong.shellcheck",
36+
"charliermarsh.ruff"
37+
],
38+
"settings": {
39+
"python.defaultInterpreterPath": "/usr/local/bin/python3.12",
40+
"autoDocstring.docstringFormat": "google",
41+
"mypy-type-checker.importStrategy": "fromEnvironment",
42+
"python.testing.pytestEnabled": true,
43+
"[python]": {
44+
"editor.defaultFormatter": "charliermarsh.ruff",
45+
"editor.codeActionsOnSave": {
46+
"source.fixAll.ruff": "explicit",
47+
"source.organizeImports.ruff": "explicit"
48+
},
49+
"editor.formatOnSave": true
50+
},
51+
"files.insertFinalNewline": true,
52+
"files.trimTrailingWhitespace": true,
53+
"terminal.integrated.defaultProfile.linux": "zsh",
54+
"terminal.integrated.profiles.linux": {
55+
"zsh": {
56+
"path": "/bin/zsh"
57+
}
58+
}
59+
}
60+
}
61+
},
62+
"mounts": [
63+
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
64+
],
65+
"postStartCommand": "pre-commit install && sudo chown vscode .git/hooks/pre-commit"
66+
}

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PYTHONPATH=src
2+
WORKSPACE_NAME=
3+
RESOURCE_GROUP=
4+
MODEL_API_BASE_URL1=
5+
MODEL_API_KEY1=
6+
MODEL_API_BASE_URL2=
7+
MODEL_API_KEY2=

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
push:
6+
branches:
7+
- main
8+
permissions:
9+
contents: read
10+
actions: read
11+
checks: write
12+
env:
13+
pythonVersion: 3.12.7
14+
jobs:
15+
Build_Stage_Build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Install Linux packages
21+
run: |
22+
apt update && apt install -y \
23+
sudo \
24+
wget \
25+
curl \
26+
gcc \
27+
ca-certificates \
28+
build-essential \
29+
libssl-dev \
30+
zlib1g-dev \
31+
libbz2-dev \
32+
libreadline-dev \
33+
libffi-dev \
34+
llvm \
35+
xz-utils \
36+
git \
37+
libsqlite3-dev
38+
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3
39+
sudo apt-get clean -y
40+
sudo rm -rf /var/lib/apt/lists/*
41+
- name: Use Python ${{ env.pythonVersion }}
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ env.pythonVersion }}
45+
cache: 'poetry'
46+
- name: Install Python dependencies
47+
run: poetry install --no-root
48+
- name: Run Ruff
49+
run: poetry run ruff check --output-format=github .
50+
- name: Run pytest
51+
run: poetry run pytest --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-config=pyproject.toml
52+
- name: Publish Test Results
53+
uses: dorny/test-reporter@v1
54+
if: always()
55+
with:
56+
name: pytest
57+
path: |
58+
**/test-results.xml
59+
reporter: java-junit
60+
- name: Publish Code Coverage Summary Report
61+
uses: irongut/CodeCoverageSummary@v1.3.0
62+
with:
63+
badge: true
64+
output: both
65+
format: markdown
66+
filename: coverage.xml
67+
68+
- name: Add code coverage summary markdown to github step summary
69+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
70+
71+
- name: Archive test and code coverage results
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: test-and-coverage-results
75+
path: |
76+
**/test-results-*.xml
77+
coverage.xml

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
data/*
2+
!data/examples
3+
.vscode
4+
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.7.0
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
name: ruff-check
9+
types_or: [python, pyi]
10+
11+
- id: ruff
12+
# Run the sort imports
13+
name: sort imports with ruff
14+
types_or: [python, pyi]
15+
args: [--select, I, --fix]
16+
17+
# Run the formatter.
18+
- id: ruff-format
19+
types_or: [python, pyi]
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"functions": [
3+
{
4+
"type": "function",
5+
"function": {
6+
"name": "adjust_temperature",
7+
"description": "Set the cabin temperature directly.",
8+
"parameters": {
9+
"type": "object",
10+
"properties": {
11+
"temperature": {
12+
"type": "number",
13+
"minimum": 60,
14+
"maximum": 90,
15+
"description": "The desired cabin temperature in Fahrenheit."
16+
}
17+
},
18+
"required": [
19+
"temperature"
20+
]
21+
}
22+
}
23+
},
24+
{
25+
"type": "function",
26+
"function": {
27+
"name": "play_audio_track",
28+
"description": "Play an audio track or playlist through the car's entertainment system using a supported streaming service.",
29+
"parameters": {
30+
"type": "object",
31+
"properties": {
32+
"service": {
33+
"type": "string",
34+
"enum": [
35+
"StreamX",
36+
"MusicBox",
37+
"TuneStream"
38+
],
39+
"description": "The streaming service to use for audio playback."
40+
},
41+
"media_type": {
42+
"type": "string",
43+
"enum": [
44+
"track",
45+
"playlist"
46+
],
47+
"description": "Specifies whether to play a single track or a playlist."
48+
},
49+
"title": {
50+
"type": "string",
51+
"description": "The title of the audio track or playlist."
52+
}
53+
},
54+
"required": [
55+
"service",
56+
"media_type",
57+
"title"
58+
]
59+
}
60+
}
61+
}
62+
]
63+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{"query": "Set the temperature to 72 degrees", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 72}}]}
2+
{"query": "Adjust cabin temp to 65 degrees Fahrenheit", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 65}}]}
3+
{"query": "Make it 78 degrees in here", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 78}}]}
4+
{"query": "Can you make it warmer? About 80 degrees would be nice", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 80}}]}
5+
{"query": "I'm feeling too warm, set temperature to 68", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 68}}]}
6+
{"query": "Change the cabin temperature to 75 degrees", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 75}}]}
7+
{"query": "It's cold, crank up the heat to 85", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 85}}]}
8+
{"query": "Set the temperature to a comfortable 70 degrees", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 70}}]}
9+
{"query": "I need it to be 62 degrees in the cabin", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 62}}]}
10+
{"query": "Let's set the car to 88 degrees", "function_calls": [{"function_name": "adjust_temperature", "arguments": {"temperature": 88}}]}
11+
{"query": "Play my favorite rock playlist on StreamX", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "StreamX", "media_type": "playlist", "title": "Rock Favorites"}}]}
12+
{"query": "Start the classical music playlist on TuneStream", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "TuneStream", "media_type": "playlist", "title": "Classical Music"}}]}
13+
{"query": "Play the song 'Starlight' on MusicBox", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "MusicBox", "media_type": "track", "title": "Starlight"}}]}
14+
{"query": "I want to hear the 'Road Trip Favorites' playlist on StreamX", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "StreamX", "media_type": "playlist", "title": "Road Trip Favorites"}}]}
15+
{"query": "Play Mozart's Symphony on TuneStream", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "TuneStream", "media_type": "track", "title": "Mozart's Symphony"}}]}
16+
{"query": "Start track 'Summer Hits' using MusicBox", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "MusicBox", "media_type": "track", "title": "Summer Hits"}}]}
17+
{"query": "Play the jazz playlist on TuneStream please", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "TuneStream", "media_type": "playlist", "title": "Jazz"}}]}
18+
{"query": "Can you play 'Ocean Waves' track on StreamX?", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "StreamX", "media_type": "track", "title": "Ocean Waves"}}]}
19+
{"query": "Play my workout playlist on MusicBox", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "MusicBox", "media_type": "playlist", "title": "Workout"}}]}
20+
{"query": "Start the audiobook 'The Great Gatsby' on TuneStream", "function_calls": [{"function_name": "play_audio_track", "arguments": {"service": "TuneStream", "media_type": "track", "title": "The Great Gatsby"}}]}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json
2+
name: data_synthesis_environment
3+
build:
4+
path: ../
5+
dockerfile_path: .devcontainer/Dockerfile

0 commit comments

Comments
 (0)