Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/previous' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
fit-alessandro-berti committed Oct 28, 2024
2 parents ad5b353 + 090e425 commit ae40ce3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ RUN apt-get -y install gcc g++ flex bison pkg-config automake autoconf cmake
RUN apt-get -y install python3-dev python3-pydot python3-tk
RUN apt-get -y install libopenblas-dev liblapack-dev libboost-all-dev libncurses5-dev libtool libssl-dev libjemalloc-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev libxml2-dev libxslt-dev libfreetype6-dev libsuitesparse-dev libclang-16-dev llvm-16-dev libthrift-dev libfftw3-dev
RUN python3 -m pip install --upgrade pip
RUN pip3 install deprecation==2.1.0 graphviz==0.20.3 intervaltree==3.1.0 networkx==3.3 packaging==24.1 python-dateutil==2.9.0.post0 pytz==2024.2 setuptools==75.1.0 six==1.16.0 sortedcontainers==2.4.0 tzdata==2024.2 wheel==0.44.0
RUN pip3 install colorama==0.4.6 cycler==0.12.1 pydotplus==2.0.2 pyparsing==3.1.4 tqdm==4.66.5
RUN pip3 install deprecation==2.1.0 graphviz==0.20.3 intervaltree==3.1.0 networkx==3.4.2 packaging==24.1 python-dateutil==2.9.0.post0 pytz==2024.2 setuptools==75.2.0 six==1.16.0 sortedcontainers==2.4.0 tzdata==2024.2 wheel==0.44.0
RUN pip3 install colorama==0.4.6 cycler==0.12.1 pydotplus==2.0.2 pyparsing==3.2.0 tqdm==4.66.5
RUN pip3 install lxml==5.3.0 numpy==2.1.2 pandas==2.2.3 scipy==1.14.1
RUN pip3 install contourpy==1.3.0 fonttools==4.54.1 kiwisolver==1.4.7 matplotlib==3.9.2 pillow==10.4.0
RUN pip3 install anyio==4.6.0 attrs==24.2.0 certifi==2024.8.30 charset-normalizer==3.3.2 distro==1.9.0 h11==0.14.0 httpcore==1.0.6 httpx==0.27.2 idna==3.10 jiter==0.6.1 jsonschema-specifications==2024.10.1 pydantic==2.9.2 referencing==0.35.1 rpds-py==0.20.0 sniffio==1.3.1 typing_extensions==4.12.2 urllib3==2.2.3
RUN pip3 install jsonschema==4.23.0 openai==1.51.2 requests==2.32.3
RUN pip3 install contourpy==1.3.0 fonttools==4.54.1 kiwisolver==1.4.7 matplotlib==3.9.2 pillow==11.0.0
RUN pip3 install anyio==4.6.2.post1 asttokens==2.4.1 attrs==24.2.0 certifi==2024.8.30 charset-normalizer==3.4.0 convertdate==2.4.0 decorator==5.1.1 distro==1.9.0 executing==2.1.0 h11==0.14.0 httpcore==1.0.6 httpx==0.27.2 idna==3.10 ipython==8.29.0 jedi==0.19.1 Jinja2==3.1.4 jsonpickle==3.3.0 jsonschema-specifications==2024.10.1 lunardate==0.2.2 MarkupSafe==3.0.2 matplotlib-inline==0.1.7 parso==0.8.4 prompt-toolkit==3.0.48 pure-eval==0.2.3 pydantic==2.9.2 Pygments==2.18.0 pyluach==2.2.0 PyMeeus==0.5.12 referencing==0.35.1 rpds-py==0.20.0 sniffio==1.3.1 stack-data==0.6.3 traitlets==5.14.3 typing_extensions==4.12.2 urllib3==2.2.3 wcwidth==0.2.13
RUN pip3 install jsonschema==4.23.0 openai==1.52.2 pyvis==0.3.2 requests==2.32.3 workalendar==17.0.0
RUN pip3 install -U meson-python==0.15.0 Cython==3.0.10 ninja==1.11.1.1 spin==0.8 build==1.2.1 setuptools_scm==8.0.4

#RUN cd / && git clone https://github.com/numpy/numpy.git && cd /numpy && git submodule update --init && pip3 install .
Expand Down
9 changes: 6 additions & 3 deletions pm4py/algo/querying/llm/connectors/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from enum import Enum
from pm4py.util import exec_utils
from typing import Optional, Dict, Any
import base64
import base64, os
from pm4py.util import constants


Expand All @@ -27,6 +27,7 @@ class Parameters(Enum):
API_KEY = "api_key"
OPENAI_MODEL = "openai_model"
IMAGE_PATH = "image_path"
MAX_TOKENS = "max_tokens"


def encode_image(image_path):
Expand Down Expand Up @@ -70,9 +71,11 @@ def apply(prompt: str, parameters: Optional[Dict[Any, Any]] = None) -> str:
}

if image_path is not None:
max_tokens = exec_utils.get_param_value(Parameters.MAX_TOKENS, parameters, 4096)
image_format = os.path.splitext(image_path)[1][1:].lower()
base64_image = encode_image(image_path)
messages[0]["content"].append({"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{base64_image} "}})
payload["max_tokens"] = 4096
messages[0]["content"].append({"type": "image_url", "image_url": {"url": f"data:image/{image_format};base64,{base64_image}"}})
payload["max_tokens"] = max_tokens

payload["messages"] = messages

Expand Down
8 changes: 4 additions & 4 deletions requirements_stable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ intervaltree==3.1.0
kiwisolver==1.4.7
lxml==5.3.0
matplotlib==3.9.2
networkx==3.3
networkx==3.4.2
numpy==2.1.2
packaging==24.1
pandas==2.2.3
pillow==10.4.0
pillow==11.0.0
pydotplus==2.0.2
pyparsing==3.1.4
pyparsing==3.2.0
python-dateutil==2.9.0.post0
pytz==2024.2
scipy==1.14.1
setuptools==75.1.0
setuptools==75.2.0
six==1.16.0
sortedcontainers==2.4.0
tqdm==4.66.5
Expand Down
8 changes: 4 additions & 4 deletions third_party/LICENSES_TRANSITIVE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
| kiwisolver | https://pypi.org/project/kiwisolver | BSD License | 1.4.7 |
| lxml | https://pypi.org/project/lxml | BSD License (BSD-3-Clause) | 5.3.0 |
| matplotlib | https://pypi.org/project/matplotlib | Python Software Foundation License | 3.9.2 |
| networkx | https://pypi.org/project/networkx | BSD License | 3.3 |
| networkx | https://pypi.org/project/networkx | BSD License | 3.4.2 |
| numpy | https://pypi.org/project/numpy | BSD License | 2.1.2 |
| packaging | https://pypi.org/project/packaging | Apache Software License, BSD License | 24.1 |
| pandas | https://pypi.org/project/pandas | BSD License | 2.2.3 |
| pillow | https://pypi.org/project/pillow | Historical Permission Notice and Disclaimer (HPND) (HPND) | 10.4.0 |
| pillow | https://pypi.org/project/pillow | CMU License (MIT-CMU) (MIT-CMU) | 11.0.0 |
| pydotplus | https://pypi.org/project/pydotplus | MIT License (UNKNOWN) | 2.0.2 |
| pyparsing | https://pypi.org/project/pyparsing | MIT License | 3.1.4 |
| pyparsing | https://pypi.org/project/pyparsing | MIT License | 3.2.0 |
| python-dateutil | https://pypi.org/project/python-dateutil | Apache Software License, BSD License (Dual License) | 2.9.0.post0 |
| pytz | https://pypi.org/project/pytz | MIT License (MIT) | 2024.2 |
| scipy | https://pypi.org/project/scipy | BSD License | 1.14.1 |
| setuptools | https://pypi.org/project/setuptools | MIT License | 75.1.0 |
| setuptools | https://pypi.org/project/setuptools | MIT License | 75.2.0 |
| six | https://pypi.org/project/six | MIT License (MIT) | 1.16.0 |
| sortedcontainers | https://pypi.org/project/sortedcontainers | Apache Software License (Apache 2.0) | 2.4.0 |
| tqdm | https://pypi.org/project/tqdm | MIT License, Mozilla Public License 2.0 (MPL 2.0) (MPL-2.0 AND MIT) | 4.66.5 |
Expand Down

0 comments on commit ae40ce3

Please sign in to comment.