Skip to content

Commit 0d984ac

Browse files
committed
Merge branch 'azdenvgetval' of https://github.com/Azure-Samples/rag-postgres-openai-python into azdenvgetval
2 parents 07ab2ba + 93a32e2 commit 0d984ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+234438
-1006
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
},
1919
"ghcr.io/azure/azure-dev/azd:latest": {},
2020
// Required for azd to package the app to ACA
21-
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
21+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
22+
"ghcr.io/prulloac/devcontainer-features/ollama:1": {}
2223
},
2324
// Configure tool-specific properties.
2425
"customizations": {

.env.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ AZURE_OPENAI_CHAT_MODEL=gpt-35-turbo
1818
AZURE_OPENAI_EMBED_DEPLOYMENT=text-embedding-ada-002
1919
AZURE_OPENAI_EMBED_MODEL=text-embedding-ada-002
2020
AZURE_OPENAI_EMBED_MODEL_DIMENSIONS=1536
21+
AZURE_OPENAI_EMBEDDING_COLUMN=embedding_ada002
2122
# Only needed when using key-based Azure authentication:
2223
AZURE_OPENAI_KEY=
2324
# Needed for OpenAI.com:
2425
OPENAICOM_KEY=YOUR-OPENAI-API-KEY
2526
OPENAICOM_CHAT_MODEL=gpt-3.5-turbo
2627
OPENAICOM_EMBED_MODEL=text-embedding-ada-002
2728
OPENAICOM_EMBED_MODEL_DIMENSIONS=1536
29+
OPENAICOM_EMBEDDING_COLUMN=embedding_ada002
2830
# Needed for Ollama:
2931
OLLAMA_ENDPOINT=http://host.docker.internal:11434/v1
30-
OLLAMA_CHAT_MODEL=phi3:3.8b
32+
OLLAMA_CHAT_MODEL=llama3.1
33+
OLLAMA_EMBED_MODEL=nomic-embed-text
34+
OLLAMA_EMBEDDING_COLUMN=embedding_nomic

.github/workflows/app-tests.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,15 @@ jobs:
7373
- name: Run MyPy
7474
run: python3 -m mypy .
7575
- name: Run Pytest
76-
run: python3 -m pytest
76+
run: python3 -m pytest -s -vv --cov --cov-fail-under=85
77+
- name: Run E2E tests with Playwright
78+
id: e2e
79+
run: |
80+
playwright install chromium --with-deps
81+
python3 -m pytest tests/e2e.py --tracing=retain-on-failure
82+
- name: Upload test artifacts
83+
if: ${{ failure() && steps.e2e.conclusion == 'failure' }}
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: playwright-traces${{ matrix.python_version }}
87+
path: test-results

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,5 @@ npm-debug.log*
146146
node_modules
147147
static/
148148

149+
# Playwright test trace
150+
test-results/

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ repos:
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
7+
exclude: ^tests/snapshots
78
- id: trailing-whitespace
89
- repo: https://github.com/astral-sh/ruff-pre-commit
910
rev: v0.1.0

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
"name": "Backend",
1818
"type": "debugpy",
1919
"request": "launch",
20+
"cwd": "${workspaceFolder}",
2021
"module": "uvicorn",
2122
"args": ["fastapi_app:create_app", "--factory", "--reload"],
22-
"justMyCode": true
23+
"justMyCode": false
2324
}
2425
],
2526
"compounds": [

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@
2222
"ssl": true
2323
}
2424
}
25-
]
25+
],
26+
"python.testing.pytestArgs": [
27+
"tests"
28+
],
29+
"python.testing.unittestEnabled": false,
30+
"python.testing.pytestEnabled": true
2631
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ A related option is VS Code Dev Containers, which will open the project in your
7373
```
7474

7575
3. Open the project folder
76-
4. Install required Python packages:
76+
4. Install required Python packages and backend application:
7777

7878
```shell
7979
pip install -r requirements-dev.txt
80+
pip install -e src/backend
8081
```
8182

8283
5. Continue with the [deployment steps](#deployment)
@@ -125,7 +126,7 @@ Since the local app uses OpenAI models, you should first deploy it for the optim
125126
```
126127
127128
3. To use OpenAI.com OpenAI, set `OPENAI_CHAT_HOST` and `OPENAI_EMBED_HOST` to "openai". Then fill in the value for `OPENAICOM_KEY`.
128-
4. To use Ollama, set `OPENAI_CHAT_HOST` to "ollama". Then update the values for `OLLAMA_ENDPOINT` and `OLLAMA_CHAT_MODEL` to match your local setup and model. Note that you won't be able to use function calling with an Ollama model, and you'll need to either turn off vector search or use either "azure" or "openai" for `OPENAI_EMBED_HOST`.
129+
4. To use Ollama, set `OPENAI_CHAT_HOST` to "ollama". Then update the values for `OLLAMA_ENDPOINT` and `OLLAMA_CHAT_MODEL` to match your local setup and model. Note that most Ollama models are not compatible with the "Advanced flow", due to the need for function calling support, so you'll need to disable that in _Developer Settings_ in the UI. In addition, the database rows are embedded using the default OpenAI embedding model, so you can't search them using an Ollama embedding model. You can either choose to set `OPENAI_EMBED_HOST` to "azure" or "openai", or turn off vector search in _Developer Settings_.
129130
130131
### Running the frontend and backend
131132

docs/images/streaming.gif

218 KB
Loading

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ python_version = 3.12
1111
exclude = [".venv/*"]
1212

1313
[tool.pytest.ini_options]
14-
addopts = "-ra --cov"
14+
addopts = "-ra"
1515
testpaths = ["tests"]
16-
pythonpath = ['src']
16+
pythonpath = ['src/backend']
1717
filterwarnings = ["ignore::DeprecationWarning"]
1818

1919
[[tool.mypy.overrides]]

0 commit comments

Comments
 (0)