diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 33279a3..91987e6 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -66,7 +66,7 @@ jobs: # Upload MegaLinter artifacts - name: Archive production artifacts - if: ${{ success() }} || ${{ failure() }} + if: ${{ success() || failure() }} uses: actions/upload-artifact@v2 with: name: MegaLinter reports diff --git a/docs/getting_started/quickstart.md b/docs/getting_started/quickstart.md index 3299a63..0eb7c16 100644 --- a/docs/getting_started/quickstart.md +++ b/docs/getting_started/quickstart.md @@ -55,3 +55,25 @@ DesanitizeResponse(desanitized_text='Sarah Jane and John Smith will be meeting i ## Using OpaquePrompts with LangChain OpaquePrompts offers a [LangChain](https://python.langchain.com/docs/get_started/introduction.html) integration, enabling you to easily build privacy-preserving LLM applications. See the [OpaquePrompts page in the LangChain documentation](https://python.langchain.com/docs/integrations/llms/opaqueprompts) for more. + +## Troubleshooting + +### Version Mismatch + +We may make breaking changes and drop support for old versions of the Python package. If this happens, you should see an error message like this when making a `sanitize` or `desanitize` call: + +``` +Request sent using package version 0.1.0, but minimum supported version is 0.2.0. Please update the opaqueprompts package to a supported version. +``` + +If you see this, simply upgrade `opaqueprompts` with `pip install -U opaqueprompts` and then you should be able to continue using the package without issue. + +### Missing Version Header + +The logic to gracefully handle version mismatch was not added to the `opaqueprompts` package until version 0.1.0. As such, if you are using an older version of `opaqueprompts`, you may see the following error: + +``` +Client-Version header not set, please ensure this request was sent using opaqueprompts version >= 0.1.0 +``` + +If you see this, make sure to update your `opaqueprompts` package to the latest version per the instructions in the "Version Mismatch" section. diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index dd7ce6b..3db79b2 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opaqueprompts" -version = "0.0.6" +version = "0.1.0" description = "The client-side SDK for OpaquePrompts, a privacy layer that enables applications to wrap external provider calls with a sanitization mechanism that hides sensitive inputs via an attested trusted execution environment." readme = "README.md" authors= [{ name = "Opaque Systems", email = "pypi@opaque.co" }] diff --git a/python-package/src/opaqueprompts/opaqueprompts_service.py b/python-package/src/opaqueprompts/opaqueprompts_service.py index 6857c99..aa8d44c 100644 --- a/python-package/src/opaqueprompts/opaqueprompts_service.py +++ b/python-package/src/opaqueprompts/opaqueprompts_service.py @@ -7,6 +7,7 @@ from dataclasses import dataclass from http import HTTPStatus from http.client import HTTPException +from importlib import metadata from typing import Dict, List, Optional, Union import requests @@ -197,7 +198,10 @@ def _send_request_to_opaqueprompts_service( response = _session.request( "POST", f"{http_protocol}://{hostname}:{port}/{endpoint}", - headers={"Authorization": f"Bearer {api_key}"}, + headers={ + "Authorization": f"Bearer {api_key}", + "Client-Version": metadata.version("opaqueprompts"), + }, data=json.dumps(payload), timeout=timeout, )