Skip to content

Commit 390eb7c

Browse files
committed
Add support for everything
1 parent 29ea501 commit 390eb7c

19 files changed

+181
-17
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
33
{
4-
"name": "Python 3",
4+
"name": "python-openai-demos (Azure OpenAI)",
55
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
66

77
"features": {
@@ -14,10 +14,7 @@
1414
"vscode": {
1515
// Set *default* container specific settings.json values on container create.
1616
"settings": {
17-
"python.defaultInterpreterPath": "/usr/local/bin/python",
18-
"files.exclude": {
19-
"__pycache__": true
20-
}
17+
"python.defaultInterpreterPath": "/usr/local/bin/python"
2118
},
2219

2320
// Add the IDs of extensions you want installed when the container is created.
@@ -29,9 +26,6 @@
2926
}
3027
},
3128

32-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
33-
// "forwardPorts": [],
34-
3529
// Use 'postCreateCommand' to run commands after the container is created.
3630
"postCreateCommand": "pip3 install --user -r requirements-dev.txt",
3731

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
3+
{
4+
"name": "python-openai-demos (GitHub models)",
5+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
6+
"features": {
7+
},
8+
// Configure tool-specific properties.
9+
"customizations": {
10+
// Configure properties specific to VS Code.
11+
"vscode": {
12+
// Set *default* container specific settings.json values on container create.
13+
"settings": {
14+
"python.defaultInterpreterPath": "/usr/local/bin/python"
15+
},
16+
17+
// Add the IDs of extensions you want installed when the container is created.
18+
"extensions": [
19+
"ms-python.python",
20+
"charliermarsh.ruff",
21+
"ms-python.black-formatter"
22+
]
23+
}
24+
},
25+
26+
// Use 'postCreateCommand' to run commands after the container is created.
27+
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.github .env",
28+
29+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
30+
"remoteUser": "vscode"
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
3+
{
4+
"name": "python-openai-demos (Ollama)",
5+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
6+
"features": {
7+
"ghcr.io/prulloac/devcontainer-features/ollama:1": {}
8+
},
9+
// Configure tool-specific properties.
10+
"customizations": {
11+
// Configure properties specific to VS Code.
12+
"vscode": {
13+
// Set *default* container specific settings.json values on container create.
14+
"settings": {
15+
"python.defaultInterpreterPath": "/usr/local/bin/python"
16+
},
17+
18+
// Add the IDs of extensions you want installed when the container is created.
19+
"extensions": [
20+
"ms-python.python",
21+
"charliermarsh.ruff",
22+
"ms-python.black-formatter"
23+
]
24+
}
25+
},
26+
27+
// Use 'postCreateCommand' to run commands after the container is created.
28+
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.ollama .env",
29+
30+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
31+
"remoteUser": "vscode"
32+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
3+
{
4+
"name": "python-openai-demos (Ollama)",
5+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
6+
// Configure tool-specific properties.
7+
"customizations": {
8+
// Configure properties specific to VS Code.
9+
"vscode": {
10+
// Set *default* container specific settings.json values on container create.
11+
"settings": {
12+
"python.defaultInterpreterPath": "/usr/local/bin/python"
13+
},
14+
15+
// Add the IDs of extensions you want installed when the container is created.
16+
"extensions": [
17+
"ms-python.python",
18+
"charliermarsh.ruff",
19+
"ms-python.black-formatter"
20+
]
21+
}
22+
},
23+
24+
// Use 'postCreateCommand' to run commands after the container is created.
25+
"postCreateCommand": "pip3 install --user -r requirements-dev.txt && cp .env.sample.openai .env",
26+
27+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
28+
"remoteUser": "vscode"
29+
}

.env.sample

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# API_HOST can be either azure, ollama, or openai:
1+
# API_HOST can be either azure, ollama, openai, or github:
22
API_HOST=azure
33
# Needed for Azure:
44
AZURE_OPENAI_ENDPOINT=https://YOUR-AZURE-OPENAI-SERVICE-NAME.openai.azure.com
55
AZURE_OPENAI_DEPLOYMENT=YOUR-AZURE-DEPLOYMENT-NAME
66
AZURE_OPENAI_VERSION=2024-03-01-preview
77
# Needed for Ollama:
88
OLLAMA_ENDPOINT=http://localhost:11434/v1
9-
OLLAMA_MODEL=llama2
9+
OLLAMA_MODEL=llama3.1
1010
# Needed for OpenAI.com:
1111
OPENAI_KEY=YOUR-OPENAI-KEY
1212
OPENAI_MODEL=gpt-3.5-turbo
13+
# Needed for GitHub models:
14+
GITHUB_MODELS_ENDPOINT="https://models.inference.ai.azure.com"
15+
GITHUB_MODELS_MODEL=gpt-4o

.env.sample.azure

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# See .env.sample for all options
2+
API_HOST=azure
3+
AZURE_OPENAI_ENDPOINT=https://YOUR-AZURE-OPENAI-SERVICE-NAME.openai.azure.com
4+
AZURE_OPENAI_DEPLOYMENT=YOUR-AZURE-DEPLOYMENT-NAME
5+
AZURE_OPENAI_VERSION=2024-03-01-preview

.env.sample.github

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# See .env.sample for all options
2+
API_HOST=github
3+
GITHUB_MODEL=gpt-4o

.env.sample.ollama

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See .env.sample for all options
2+
API_HOST=ollama
3+
OLLAMA_ENDPOINT=http://localhost:11434/v1
4+
OLLAMA_MODEL=llama3.1

.env.sample.openai

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See .env.sample for all options
2+
API_HOST=openai
3+
OPENAI_KEY=YOUR-OPENAI-KEY
4+
OPENAI_MODEL=gpt-3.5-turbo

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.exclude": {
3+
"__pycache__": true
4+
}
5+
}

0 commit comments

Comments
 (0)