From c4f7d111cad77646064a3b90760f739d6ea96d0b Mon Sep 17 00:00:00 2001 From: julio Almeida Date: Tue, 19 Nov 2024 13:01:33 +0100 Subject: [PATCH] check if version has changed, to avoid error. --- .github/workflows/workflow.yml | 18 +++++++++++++++++- extract_thinker/llm.py | 8 +------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 18d95d0..0f196ff 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -31,8 +31,24 @@ jobs: - name: Build package run: poetry build + - name: Check version change + id: check_version + run: | + git fetch origin main + # Extract version from current pyproject.toml + current_version=$(poetry version -s) + # Extract version from main branch pyproject.toml + main_version=$(git show origin/main:pyproject.toml | grep "^version = " | cut -d'"' -f2) + if [ "$current_version" != "$main_version" ]; then + echo "Version changed from $main_version to $current_version" + echo "version_changed=true" >> $GITHUB_OUTPUT + else + echo "Version unchanged" + echo "version_changed=false" >> $GITHUB_OUTPUT + fi + - name: Publish to PyPI - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_version.outputs.version_changed == 'true' uses: pypa/gh-action-pypi-publish@v1.4.2 with: user: __token__ diff --git a/extract_thinker/llm.py b/extract_thinker/llm.py index c9124ef..75e310e 100644 --- a/extract_thinker/llm.py +++ b/extract_thinker/llm.py @@ -45,10 +45,4 @@ def request(self, messages: List[Dict[str, str]], response_model: str) -> Any: api_version=self.api_version ) - return response - - def batch_request(self, batch_requests: List[Dict[str, Any]]) -> str: - return self.batch_client.create_batch(batch_requests) - - def retrieve_batch_results(self, batch_id: str) -> BatchResult: - return self.batch_client.get_batch_results(batch_id) + return response \ No newline at end of file