From 62a3391045434a681e8e74d087251d076fbf4c79 Mon Sep 17 00:00:00 2001 From: dgarnitz <126617947+dgarnitz@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:41:13 -0700 Subject: [PATCH] updated pip package readme & fix bugs with GH action (#89) updated pip package readme & fix bugs with GH action --- .../{run_unittests.yml => unittests.yml} | 11 ++++------ README.md | 8 ++++--- client/README.md | 5 +---- setup-client.py | 18 --------------- setup.py | 22 ++++++++----------- vectorflow.py | 10 --------- 6 files changed, 19 insertions(+), 55 deletions(-) rename .github/workflows/{run_unittests.yml => unittests.yml} (85%) delete mode 100644 setup-client.py delete mode 100644 vectorflow.py diff --git a/.github/workflows/run_unittests.yml b/.github/workflows/unittests.yml similarity index 85% rename from .github/workflows/run_unittests.yml rename to .github/workflows/unittests.yml index b91ddcb..acca1a5 100644 --- a/.github/workflows/run_unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,5 +1,5 @@ -name: Vectorflow_Unittests +name: Unittests on: pull_request: @@ -8,12 +8,9 @@ on: jobs: - build: - + unittests: + name: Unit Tests runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10"] env: LOCAL_VECTOR_DB: qdrant @@ -23,7 +20,7 @@ jobs: - name: Setup Python # Set Python version uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: 3.9 - name: Install dependencies - Api run: | diff --git a/README.md b/README.md index 3405f20..8205ac6 100644 --- a/README.md +++ b/README.md @@ -35,19 +35,21 @@ cd vectorflow ``` #### Embed Documents with Client -To start embedding documents locally, [install the VectorFlow Client python library](https://pypi.org/project/vectorflow-client/) +To start embedding documents locally, [install the VectorFlow Client python library](https://pypi.org/project/vectorflow-client/) in your python application's virtual environment. ``` pip install vectorflow-client ``` then run the following ``` +from vectorflow-client.client.vectorflow import Vectorflow + vectorflow = Vectorflow() vectorflow.embeddings_api_key = os.getenv("OPEN_AI_KEY") -paths = ['path_to_your_file'] +paths = ['path_to_your_file1', 'path_to_your_file2', ...] response = vectorflow.upload(paths) ``` -for more instructions see the `README.md` in the `client` directory. +You do **not** need to clone the VectorFlow repo to utilize the client functionality via pip. For more instructions see the `README.md` in the `client` directory. See the appendix for details on how to use the `testing_clients` scripts. diff --git a/client/README.md b/client/README.md index 478405f..8ebcf5b 100644 --- a/client/README.md +++ b/client/README.md @@ -1,15 +1,12 @@ # VectorFlow Python Client Use this Python client to embed documents with VectorFlow and check on the status of those embeddings. - - - ### How to Use The client has 2 methods for uploading documents to embed and 2 for checking statuses, listed below. All four methods return a python `response` object from the python `requests` library. You must parse the response using the `.json()` method. #### Initialize ``` -from client.vectorflow import Vectorflow +from vectorflow-client.client.vectorflow import Vectorflow vectorflow = Vectorflow() vectorflow.embedding_api_key = "YOUR_OPEN_AI_KEY" diff --git a/setup-client.py b/setup-client.py deleted file mode 100644 index 50d8120..0000000 --- a/setup-client.py +++ /dev/null @@ -1,18 +0,0 @@ -from setuptools import setup, find_packages - -# Read the content of your README file -with open("./client/README.md", "r", encoding="utf-8") as fh: - long_description = fh.read() - -setup( - name="vectorflow-client", - version="0.0.3", - packages=find_packages(where="client") + ["shared"], - package_dir={"": "client", "shared": "src/shared"}, - install_requires=[ - 'requests==2.31.0' - ], - include_package_data=True, # This is the line that reads the MANIFEST.in - long_description=long_description, - long_description_content_type="text/markdown", -) diff --git a/setup.py b/setup.py index bfc214e..7d90e3b 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,18 @@ -from setuptools import setup +from setuptools import setup, find_packages # Read the content of your README file -with open("README.md", "r", encoding="utf-8") as fh: +with open("./client/README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( - name="vectorflow-ai", - version="0.1.1", # Update version as needed + name="vectorflow-client", + version="0.0.5", + packages=find_packages(where="client") + ["shared"], + package_dir={"": "client", "shared": "src/shared"}, install_requires=[ - # No dependencies right now since this is only for setting up docker-compose + 'requests==2.31.0' ], - entry_points={ - 'console_scripts': [ - 'vectorflow=vectorflow:main', - ], - }, - py_modules=["vectorflow"], - include_package_data=True, # This ensures non-python files (like your setup.sh) are included + include_package_data=True, # This is the line that reads the MANIFEST.in long_description=long_description, - long_description_content_type="text/markdown", # This is important! It tells PyPI the README is in Markdown + long_description_content_type="text/markdown", ) diff --git a/vectorflow.py b/vectorflow.py deleted file mode 100644 index 3e9ba79..0000000 --- a/vectorflow.py +++ /dev/null @@ -1,10 +0,0 @@ -import subprocess -import os - -def main(): - # Assuming setup.sh is in the same directory as this Python file. - script_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'setup.sh') - subprocess.call([script_path]) - -if __name__ == "__main__": - main()