From 26e1fc4a7dbe290d670144a39584502251b3727b Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:07:12 +0100 Subject: ~ | g4f v-0.1.4.0 (new version checking system --- g4f/__init__.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'g4f') diff --git a/g4f/__init__.py b/g4f/__init__.py index 6fe7aa10..5bf96451 100644 --- a/g4f/__init__.py +++ b/g4f/__init__.py @@ -2,9 +2,23 @@ from __future__ import annotations from g4f import models from .Provider import BaseProvider, AsyncProvider from .typing import Any, CreateResult, Union +from requests import get logging = False -version = '0.1.3.9' +version = '0.1.4.0' + +def check_pypi_version(): + try: + response = get(f"https://pypi.org/pypi/g4f/json").json() + latest_version = response["info"]["version"] + + if version != latest_version: + print(f'New pypi version: {latest_version} (current: {version}) | pip install -U g4f') + + except Exception as e: + print(f'Failed to check g4f pypi version: {e}') + +check_pypi_version() def get_model_and_provider(model: Union[models.Model, str], provider: type[BaseProvider], stream: bool): if isinstance(model, str): -- cgit v1.2.3