Skip to content

Commit 4c2dbf7

Browse files
authored
Merge pull request #2428 from BerriAI/litellm_fix_python3-8
(fix) use python 3.8 on ci/cd
2 parents faad44f + c51d25b commit 4c2dbf7

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

.circleci/config.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,32 @@ jobs:
9090
- store_test_results:
9191
path: test-results
9292

93+
installing_litellm_on_python:
94+
docker:
95+
- image: circleci/python:3.8
96+
working_directory: ~/project
97+
98+
steps:
99+
- checkout
100+
- run:
101+
name: Install Dependencies
102+
command: |
103+
python -m pip install --upgrade pip
104+
pip install python-dotenv
105+
pip install pytest
106+
pip install tiktoken
107+
pip install aiohttp
108+
pip install click
109+
pip install jinja2
110+
pip install tokenizers
111+
pip install openai
112+
- run:
113+
name: Run tests
114+
command: |
115+
pwd
116+
ls
117+
python -m pytest -vv litellm/tests/test_python_38.py
118+
93119
build_and_test:
94120
machine:
95121
image: ubuntu-2204:2023.10.1
@@ -278,6 +304,12 @@ workflows:
278304
only:
279305
- main
280306
- /litellm_.*/
307+
- installing_litellm_on_python:
308+
filters:
309+
branches:
310+
only:
311+
- main
312+
- /litellm_.*/
281313
- publish_to_pypi:
282314
requires:
283315
- local_testing

litellm/llms/prompt_templates/factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from jinja2 import Template, exceptions, Environment, meta
55
from typing import Optional, Any
66
import imghdr, base64
7+
from typing import List
78

89

910
def default_pt(messages):
@@ -633,7 +634,7 @@ def anthropic_messages_pt(messages: list):
633634
return new_messages
634635

635636

636-
def extract_between_tags(tag: str, string: str, strip: bool = False) -> list[str]:
637+
def extract_between_tags(tag: str, string: str, strip: bool = False) -> List[str]:
637638
ext_list = re.findall(f"<{tag}>(.+?)</{tag}>", string, re.DOTALL)
638639
if strip:
639640
ext_list = [e.strip() for e in ext_list]

litellm/tests/test_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_completion_claude():
6969
response = completion(
7070
model="claude-instant-1", messages=messages, request_timeout=10
7171
)
72-
# Add any assertions, here to check response args
72+
# Add any assertions here to check response args
7373
print(response)
7474
print(response.usage)
7575
print(response.usage.completion_tokens)

litellm/tests/test_python_38.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import sys, os, time
2+
import traceback, asyncio
3+
import pytest
4+
5+
sys.path.insert(
6+
0, os.path.abspath("../..")
7+
) # Adds the parent directory to the system path
8+
9+
10+
def test_using_litellm():
11+
try:
12+
import litellm
13+
14+
print("litellm imported successfully")
15+
except Exception as e:
16+
pytest.fail(
17+
f"Error occurred: {e}. Installing litellm on python3.8 failed please retry"
18+
)

0 commit comments

Comments
 (0)