Skip to content

Commit

Permalink
Upgrade openai version to 1.13 and langchain to version 0.1.9 (#1529
Browse files Browse the repository at this point in the history
)

This PRs main focus is to update the version of the OpenAI package to 1.13 to allow using the built in retry logic and improved code. In addition, the following changes are also made:

- Switch to using `langchain==0.1.9` installed via pip to get around pandas dependency issue
- Sorted the lists in `dependencies.yaml` to make merging easier in the future
- Improved logging for the `OpenAILlmService` to log all requests ordered to a file
- New feature to add default model arguments to the service to avoid repeating arguments for each client. You can now just overwrite the default args
- New feature to allow the `run_ci_local.sh` to persist any changes to the code back to the host via a volume mount.

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md).
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - Michael Demoret (https://github.com/mdemoret-nv)
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - David Gardner (https://github.com/dagardner-nv)

URL: #1529
  • Loading branch information
mdemoret-nv committed Feb 27, 2024
1 parent eeb8b51 commit 594b10c
Show file tree
Hide file tree
Showing 29 changed files with 389 additions and 230 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
# Disable conda upload for now, once we have morpheus packages in conda forge set the value to
# !fromJSON(needs.prepare.outputs.is_pr) && (fromJSON(needs.prepare.outputs.is_main_branch) && 'main' || 'dev') || ''
conda_upload_label: ""
container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-240214
test_container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-test-240214
container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-240221
test_container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-test-240221
secrets:
NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
15 changes: 10 additions & 5 deletions ci/scripts/bootstrap_local_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@

export WORKSPACE_TMP="$(pwd)/ws_tmp"
mkdir -p ${WORKSPACE_TMP}
git clone ${GIT_URL} Morpheus
cd Morpheus/
git checkout ${GIT_BRANCH}
git pull
git checkout ${GIT_COMMIT}

if [[ "${USE_HOST_GIT}" == "1" ]]; then
cd Morpheus/
else
git clone ${GIT_URL} Morpheus
cd Morpheus/
git checkout ${GIT_BRANCH}
git pull
git checkout ${GIT_COMMIT}
fi

export MORPHEUS_ROOT=$(pwd)
export WORKSPACE=${MORPHEUS_ROOT}
Expand Down
13 changes: 12 additions & 1 deletion ci/scripts/run_ci_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function git_ssh_to_https()

MORPHEUS_ROOT=${MORPHEUS_ROOT:-$(git rev-parse --show-toplevel)}

# Specifies whether to mount the current git repo (to allow changes to be persisted) or to use a clean clone (to closely
# match CI, the default)
USE_HOST_GIT=${USE_HOST_GIT:-0}

GIT_URL=$(git remote get-url origin)
GIT_URL=$(git_ssh_to_https ${GIT_URL})

Expand All @@ -51,7 +55,7 @@ GIT_BRANCH=$(git branch --show-current)
GIT_COMMIT=$(git log -n 1 --pretty=format:%H)

LOCAL_CI_TMP=${LOCAL_CI_TMP:-${MORPHEUS_ROOT}/.tmp/local_ci_tmp}
CONTAINER_VER=${CONTAINER_VER:-240214}
CONTAINER_VER=${CONTAINER_VER:-240221}
CUDA_VER=${CUDA_VER:-12.1}
DOCKER_EXTRA_ARGS=${DOCKER_EXTRA_ARGS:-""}

Expand All @@ -66,6 +70,7 @@ ENV_LIST="${ENV_LIST} --env GIT_COMMIT=${GIT_COMMIT}"
ENV_LIST="${ENV_LIST} --env PARALLEL_LEVEL=$(nproc)"
ENV_LIST="${ENV_LIST} --env CUDA_VER=${CUDA_VER}"
ENV_LIST="${ENV_LIST} --env SKIP_CONDA_ENV_UPDATE=${SKIP_CONDA_ENV_UPDATE}"
ENV_LIST="${ENV_LIST} --env USE_HOST_GIT=${USE_HOST_GIT}"

mkdir -p ${LOCAL_CI_TMP}
cp ${MORPHEUS_ROOT}/ci/scripts/bootstrap_local_ci.sh ${LOCAL_CI_TMP}
Expand All @@ -82,14 +87,20 @@ for STAGE in "${STAGES[@]}"; do
DOCKER_RUN_ARGS="${DOCKER_RUN_ARGS} --runtime=runc"
fi

if [[ "${USE_HOST_GIT}" == "1" ]]; then
DOCKER_RUN_ARGS="${DOCKER_RUN_ARGS} -v ${MORPHEUS_ROOT}:/Morpheus"
fi

if [[ "${STAGE}" == "bash" ]]; then
DOCKER_RUN_CMD="bash --init-file /ci_tmp/bootstrap_local_ci.sh"
else
DOCKER_RUN_CMD="/ci_tmp/bootstrap_local_ci.sh"
fi

echo "Running ${STAGE} stage in ${CONTAINER}"
set -x
docker run ${DOCKER_RUN_ARGS} ${DOCKER_EXTRA_ARGS} ${CONTAINER} ${DOCKER_RUN_CMD}
set +x

STATUS=$?
if [[ ${STATUS} -ne 0 ]]; then
Expand Down
5 changes: 3 additions & 2 deletions conda/environments/all_cuda-121_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ dependencies:
- isort
- jsonpatch>=1.33
- kfp
- langchain=0.0.190
- librdkafka>=1.9.2,<1.10.0a0
- libtool
- libwebp=1.3.2
Expand All @@ -67,10 +66,11 @@ dependencies:
- ninja=1.11
- nlohmann_json=3.9
- nodejs=18.*
- numexpr
- numpydoc=1.5
- nvtabular=23.08.00
- onnx
- openai=0.28
- openai=1.13
- papermill=2.4.0
- pip
- pkg-config=0.29
Expand Down Expand Up @@ -119,6 +119,7 @@ dependencies:
- dgl
- dglgo
- google-search-results==2.4
- langchain==0.1.9
- milvus==2.3.5
- nemollm
- pymilvus==2.3.6
Expand Down
5 changes: 3 additions & 2 deletions conda/environments/examples_cuda-121_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ dependencies:
- huggingface_hub=0.20.2
- jsonpatch>=1.33
- kfp
- langchain=0.0.190
- libwebp=1.3.2
- mlflow=2.9.2
- networkx=2.8.8
- newspaper3k=0.2
- nodejs=18.*
- numexpr
- numpydoc=1.5
- nvtabular=23.08.00
- onnx
- openai=0.28
- openai=1.13
- papermill=2.4.0
- pip
- pypdf=3.17.4
Expand All @@ -63,6 +63,7 @@ dependencies:
- dgl
- dglgo
- google-search-results==2.4
- langchain==0.1.9
- milvus==2.3.5
- nemollm
- pymilvus==2.3.6
Expand Down
91 changes: 41 additions & 50 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,107 +21,97 @@ files:
cuda: ["12.1"]
arch: [x86_64]
includes:
- data_retrieval
- benchmark_cpp
- build_cpp
- checks
- cudatoolkit
- cve-mitigation
- data_retrieval
- development
- benchmark_cpp
- runtime
- doca
- docs
- example-dfp-prod
- example-gnn
- example-llm-agents
- example-llm-completion
- example-llm-rag
- example-llm-vdb-upload
- test_python_morpheus
- docs
- cudatoolkit
- python
- checks
- cve-mitigation
- doca
- runtime
- test_python_morpheus

dev:
output: conda
matrix:
cuda: ["12.1"]
arch: [x86_64]
includes:
- data_retrieval
- benchmark_cpp
- build_cpp
- checks
- cudatoolkit
- data_retrieval
- development
- benchmark_cpp
- runtime
- test_python_morpheus
- docs
- cudatoolkit
- python
- checks

examples:
output: conda
matrix:
cuda: ["12.1"]
arch: [x86_64]
includes:
- examples
- runtime
- cudatoolkit
- test_python_morpheus

build:
output: none
matrix:
cuda: ["12.1"]
arch: [x86_64]
includes:
- data_retrieval
- benchmark_cpp
- build_cpp
- cudatoolkit
- data_retrieval
- development
- benchmark_cpp
- python
- runtime
- test_python_morpheus
- cudatoolkit
- python

test:
output: none
matrix:
cuda: ["12.1"]
arch: [x86_64]
includes:
- data_retrieval
- benchmark_cpp
- build_cpp
- cudatoolkit
- data_retrieval
- development
- benchmark_cpp
- runtime
- test_python_morpheus
- example-dfp-prod
- example-gnn
- example-llm-agents
- example-llm-completion
- example-llm-rag
- example-llm-vdb-upload
- cudatoolkit
- python
- runtime
- test_python_morpheus

docs:
output: none
matrix:
cuda: ["12.1"]
arch: [x86_64]
includes:
- data_retrieval
- build_cpp
- benchmark_cpp
- build_cpp
- cudatoolkit
- python
- data_retrieval
- docs
- runtime
- example-dfp-prod
- example-gnn
- example-llm-agents
- example-llm-completion
- example-llm-rag
- example-llm-vdb-upload
- python
- runtime

runtime:
output: conda
Expand All @@ -138,15 +128,15 @@ files:
cuda: ["12.1"]
arch: [x86_64]
includes:
- runtime
- cve-mitigation
- example-dfp-prod
- example-gnn
- example-llm-agents
- example-llm-completion
- example-llm-rag
- example-llm-vdb-upload
- python
- cve-mitigation
- runtime

model-utils:
output: conda
Expand Down Expand Up @@ -231,18 +221,18 @@ dependencies:
common:
- output_types: [conda]
packages:
- &click click >=8
- &numpydoc numpydoc=1.5
- breathe=4.35.0
- doxygen=1.9.2
- exhale=0.3.6
- ipython
- myst-parser=0.18.1
- nbsphinx
- pluggy=1.3
- python-graphviz
- sphinx
- sphinx_rtd_theme
- &numpydoc numpydoc=1.5
- pluggy=1.3
- &click click >=8

benchmark_cpp:
common:
Expand Down Expand Up @@ -287,10 +277,10 @@ dependencies:
- output_types: [conda]
packages:
- &nodejs nodejs=18.*
- pytest=7.4.4
- pytest-asyncio
- pytest-benchmark=4.0
- pytest-cov
- pytest=7.4.4
- python-docx==1.1.0
- pip
- pip:
Expand Down Expand Up @@ -328,12 +318,13 @@ dependencies:
- output_types: [conda]
packages:
- &grpcio-status grpcio-status==1.59
- &langchain langchain=0.0.190
- &transformers transformers=4.36.2 # newer versions are incompatible with our pinned version of huggingface_hub
- huggingface_hub=0.20.2 # work-around for https://github.com/UKPLab/sentence-transformers/issues/1762
- pip
- numexpr
- sentence-transformers
- pip
- pip:
- &langchain langchain==0.1.9
- nemollm

example-llm-completion:
Expand All @@ -350,12 +341,12 @@ dependencies:
- output_types: [conda]
packages:
- *grpcio-status
- *langchain
- anyio>=3.7
- jsonpatch>=1.33
- openai=0.28
- openai=1.13
- pip
- pip:
- *langchain
- google-search-results==2.4

example-llm-vdb-upload:
Expand All @@ -364,27 +355,27 @@ dependencies:
packages:
- *arxiv
- *grpcio-status
- *langchain
- *newspaper3k
- *pypdf
- onnx
- pip
- pip:
- PyMuPDF==1.23.21
- *langchain

model-training-tuning:
common:
- output_types: [conda]
packages:
- *cuml
- *scikit-learn
- *transformers
- jupyterlab
- matplotlib
- onnx
- pandas
- *scikit-learn
- seaborn
- seqeval=1.2.2
- *transformers
- xgboost

cve-mitigation:
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"morpheus.cli.commands", # Dont document the CLI in Sphinx
"nvtabular",
"pandas",
"pydantic",
"pymilvus",
"tensorrt",
"torch",
Expand Down
Loading

0 comments on commit 594b10c

Please sign in to comment.