diff --git a/.circleci/config.yml b/.circleci/config.yml index c94da063c..5f3ed20ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,6 +90,32 @@ jobs: - store_test_results: path: test-results + installing_litellm_on_python: + docker: + - image: circleci/python:3.8 + working_directory: ~/project + + steps: + - checkout + - run: + name: Install Dependencies + command: | + python -m pip install --upgrade pip + pip install python-dotenv + pip install pytest + pip install tiktoken + pip install aiohttp + pip install click + pip install jinja2 + pip install tokenizers + pip install openai + - run: + name: Run tests + command: | + pwd + ls + python -m pytest -vv litellm/tests/test_python_38.py + build_and_test: machine: image: ubuntu-2204:2023.10.1 @@ -278,6 +304,12 @@ workflows: only: - main - /litellm_.*/ + - installing_litellm_on_python: + filters: + branches: + only: + - main + - /litellm_.*/ - publish_to_pypi: requires: - local_testing diff --git a/litellm/llms/prompt_templates/factory.py b/litellm/llms/prompt_templates/factory.py index a13130c62..dc4207a05 100644 --- a/litellm/llms/prompt_templates/factory.py +++ b/litellm/llms/prompt_templates/factory.py @@ -4,6 +4,7 @@ import json, re, xml.etree.ElementTree as ET from jinja2 import Template, exceptions, Environment, meta from typing import Optional, Any import imghdr, base64 +from typing import List def default_pt(messages): @@ -633,7 +634,7 @@ def anthropic_messages_pt(messages: list): return new_messages -def extract_between_tags(tag: str, string: str, strip: bool = False) -> list[str]: +def extract_between_tags(tag: str, string: str, strip: bool = False) -> List[str]: ext_list = re.findall(f"<{tag}>(.+?)", string, re.DOTALL) if strip: ext_list = [e.strip() for e in ext_list] diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index e54617bd9..729bf7bd9 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -69,7 +69,7 @@ def test_completion_claude(): response = completion( model="claude-instant-1", messages=messages, request_timeout=10 ) - # Add any assertions, here to check response args + # Add any assertions here to check response args print(response) print(response.usage) print(response.usage.completion_tokens) diff --git a/litellm/tests/test_python_38.py b/litellm/tests/test_python_38.py new file mode 100644 index 000000000..077e65a3a --- /dev/null +++ b/litellm/tests/test_python_38.py @@ -0,0 +1,18 @@ +import sys, os, time +import traceback, asyncio +import pytest + +sys.path.insert( + 0, os.path.abspath("../..") +) # Adds the parent directory to the system path + + +def test_using_litellm(): + try: + import litellm + + print("litellm imported successfully") + except Exception as e: + pytest.fail( + f"Error occurred: {e}. Installing litellm on python3.8 failed please retry" + )