From 3c7362289a430c304eaff5749b289d006bb41da4 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:08:43 -0400 Subject: [PATCH] chore(infra): cleanup bashscript and respect .envrc [skip ci] Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- .envrc.template | 1 + .gitignore | 1 + all.sh | 7 +++++++ local.sh | 25 +++++++++++++++---------- openllm-python/README.md | 8 ++++---- tools/requirements.txt | 2 ++ 6 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 .envrc.template diff --git a/.envrc.template b/.envrc.template new file mode 100644 index 00000000..a35c461f --- /dev/null +++ b/.envrc.template @@ -0,0 +1 @@ +PAPERSPACE_API_KEY=$(bw get notes paperspace-api) diff --git a/.gitignore b/.gitignore index e310b879..99056e62 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,4 @@ private/ .vscode/* node_modules .eslintcache +.envrc diff --git a/all.sh b/all.sh index ba2da67b..b0660bf0 100644 --- a/all.sh +++ b/all.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +GIT_ROOT=$(git rev-parse --show-toplevel) +cd "$GIT_ROOT" || exit 1 + +if command -v direnv >/dev/null 2>&1 && [ -f "$GIT_ROOT/.envrc" ]; then + direnv allow +fi + printf "Running update-mypy.py\n" python ./tools/update-mypy.py printf "Running update-config-stubs.py\n" diff --git a/local.sh b/local.sh index 9ae21d5d..bb4070da 100755 --- a/local.sh +++ b/local.sh @@ -17,10 +17,15 @@ if [ ! -f "$GIT_ROOT/.python-version" ]; then ln -s "$GIT_ROOT/.python-version-default" "$GIT_ROOT/.python-version" fi +if [ ! -f "$GIT_ROOT/.envrc" ]; then + echo "copy .envrc.template to .envrc" + cp "$GIT_ROOT/.envrc.template" "$GIT_ROOT/.envrc" +fi + # check if there is a $GIT_ROOT/.venv directory, if not, create it if [ ! -d "$GIT_ROOT/.venv" ]; then # get the python version from $GIT_ROOT/.python-version-default - uv venv -p $(cat "$GIT_ROOT/.python-version-default") "$GIT_ROOT/.venv" + uv venv -p "$(cat "$GIT_ROOT/.python-version-default")" "$GIT_ROOT/.venv" fi . "$GIT_ROOT/.venv/bin/activate" @@ -32,14 +37,14 @@ print_usage() { # Parse command line arguments while [[ "$#" -gt 0 ]]; do case $1 in - --help | -h) - print_usage - exit 0 - ;; - *) - print_usage - exit 1 - ;; + --help | -h) + print_usage + exit 0 + ;; + *) + print_usage + exit 1 + ;; esac shift done @@ -49,7 +54,7 @@ PRERELEASE=${PRERELEASE:-false} ARGS=() [[ "${PRERELEASE}" == "true" ]] && ARGS+=("--prerelease=allow") -uv pip install "${ARGS[@]}" --editable "$GIT_ROOT/openllm-python" +uv pip install "${ARGS[@]}" --editable "$GIT_ROOT/openllm-python" || true uv pip install "${ARGS[@]}" --editable "$GIT_ROOT/openllm-client" uv pip install "${ARGS[@]}" --editable "$GIT_ROOT/openllm-core" diff --git a/openllm-python/README.md b/openllm-python/README.md index 03ab00d0..a2c87ee6 100644 --- a/openllm-python/README.md +++ b/openllm-python/README.md @@ -773,8 +773,7 @@ OpenLLM is not just a standalone product; it's a building block designed to integrate with other powerful tools easily. We currently offer integration with [OpenAI's Compatible Endpoints](https://platform.openai.com/docs/api-reference/completions/object), [LlamaIndex](https://www.llamaindex.ai/), -[LangChain](https://github.com/hwchase17/langchain), and -[Transformers Agents](https://huggingface.co/docs/transformers/transformers_agents). +[LangChain](https://github.com/hwchase17/langchain). ### OpenAI Compatible Endpoints @@ -791,7 +790,7 @@ completions = client.chat.completions.create( ) ``` -The compatible endpoints supports `/completions`, `/chat/completions`, and `/models` +The compatible endpoints supports `/chat/completions`, and `/models` > [!NOTE] > You can find out OpenAI example clients under the @@ -806,7 +805,8 @@ from llama_index.llms.openllm import OpenLLMAPI ``` > [!NOTE] -> All synchronous and asynchronous API from `llama_index.llms.LLM` are supported. +> All synchronous and asynchronous API from `llama_index.llms.OpenLLMAPI` are supported. +> Make sure to install `llama-index-integrations-llm-openllm` to use the supported class. ### [LangChain](https://python.langchain.com/docs/integrations/llms/openllm/) diff --git a/tools/requirements.txt b/tools/requirements.txt index 5c0e2907..36bb8351 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -1,2 +1,4 @@ ipython jupyter +tomlkit +ghapi