Skip to content

Commit 76bb605

Browse files
Split Image Processing for multiple stage processing and fix bugs (#140)
1 parent 2a013d8 commit 76bb605

Some content is hidden

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

55 files changed

+2591
-2201
lines changed

.funcignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.git*
2+
.vscode
3+
__azurite_db*__.json
4+
__blobstorage__
5+
__queuestorage__
6+
local.settings.json
7+
test
8+
.venv
9+
.github/*
10+
.devcontainer/*
11+
.ruff_cache/*
12+
deploy_ai_search_indexes/*
13+
text_2_sql/*
14+
documentation/*
15+
images/
16+
__pycache__

.github/workflows/ci-checks.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- "*" # Run on all branches
1111

1212
env:
13-
MIN_PYTHON_VERSION: 3.11
13+
MIN_PYTHON_VERSION: 3.12
1414

1515
jobs:
1616
job-pre-commit-check:

.pre-commit-config.yaml

+8-6
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ repos:
4545
args: [--fix, --ignore, UP007]
4646
exclude: samples
4747

48-
# - repo: https://github.com/astral-sh/uv-pre-commit
49-
# # uv version.
50-
# rev: 0.5.5
51-
# hooks:
52-
# # Update the uv lockfile
53-
# - id: uv-lock
48+
- repo: https://github.com/astral-sh/uv-pre-commit
49+
# uv version.
50+
rev: 0.5.20
51+
hooks:
52+
# Update the uv lockfile
53+
- id: uv-lock
54+
- id: uv-export
55+
args: [--frozen, --no-hashes, --no-editable, --no-sources, --verbose, --no-group, dev, --directory, image_processing, -o, src/image_processing/requirements.txt]

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12
1+
3.11

.vscode/settings.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2+
"azureFunctions.deploySubpath": "image_processing/src/image_processing",
23
"azureFunctions.projectLanguage": "Python",
34
"azureFunctions.projectLanguageModel": 2,
45
"azureFunctions.projectRuntime": "~4",
6+
"azureFunctions.pythonVenv": ".venv",
57
"azureFunctions.scmDoBuildDuringDeployment": true,
68
"debug.internalConsoleOptions": "neverOpen"
79
}

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"isBackground": true,
66
"label": "func: host start",
77
"options": {
8-
"cwd": "${workspaceFolder}/ai_search_with_adi_function_app"
8+
"cwd": "${workspaceFolder}/image_processing/src/image_processing"
99
},
1010
"problemMatcher": "$func-python-watch",
1111
"type": "func"

README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,14 @@ It is intended that the plugins and skills provided in this repository, are adap
1111
## Components
1212

1313
- `./text_2_sql` contains an three Multi-Shot implementations for Text2SQL generation and querying which can be used to answer questions backed by a database as a knowledge base. A **prompt based** and **vector based** approach are shown, both of which exhibit great performance in answering sql queries. Additionally, a further iteration on the vector based approach is shown which uses a **query cache** to further speed up generation. With these plugins, your RAG application can now access and pull data from any SQL table exposed to it to answer questions.
14-
- `./adi_function_app` contains code for linking **Azure Document Intelligence** with AI Search to process complex documents with charts and images, and uses **multi-modal models (gpt4o)** to interpret and understand these. With this custom skill, the RAG application can **draw insights from complex charts** and images during the vector search. This function app also contains a **Semantic Text Chunking** method that aims to intelligently group similar sentences, retaining figures and tables together, whilst separating out distinct sentences.
15-
- `./deploy_ai_search` provides an easy Python based utility for deploying an index, indexer and corresponding skillset for AI Search and for Text2SQL.
14+
- `./image_processing` contains code for linking **Azure Document Intelligence** with AI Search to process complex documents with charts and images, and uses **multi-modal models (gpt4o)** to interpret and understand these. With this custom skill, the RAG application can **draw insights from complex charts** and images during the vector search. This function app also contains a **Semantic Text Chunking** method that aims to intelligently group similar sentences, retaining figures and tables together, whilst separating out distinct sentences.
15+
- `./deploy_ai_search_indexes` provides an easy Python based utility for deploying an index, indexer and corresponding skillset for AI Search and for Text2SQL.
1616

1717
The above components have been successfully used on production RAG projects to increase the quality of responses.
1818

19-
_The code provided in this repo is a sample of the implementation and should be adjusted before being used in production._
20-
21-
## High Level Implementation
22-
23-
The following diagram shows a workflow for how the Text2SQL and AI Search plugin would be incorporated into a RAG application. Using the plugins available, alongside the Function Calling capabilities of LLMs, the LLM can do Chain of Thought reasoning to determine the steps needed to answer the question. This allows the LLM to recognise intent and therefore pick appropriate data sources based on the intent of the question, or a combination of both.
24-
25-
![High level workflow for a plugin driven RAG application](./images/Plugin%20Based%20RAG%20Flow.png "High Level Workflow")
19+
> [!WARNING]
20+
>
21+
> - The code provided in this repo is a accelerator of the implementation and should be review / adjusted before being used in production.
2622
2723
## Contributing
2824

adi_function_app/.env

-12
This file was deleted.

adi_function_app/GETTING_STARTED.md

-10
This file was deleted.

0 commit comments

Comments
 (0)