forked from phoenix/litellm-mirror
Merge pull request #2428 from BerriAI/litellm_fix_python3-8
(fix) use python 3.8 on ci/cd
This commit is contained in:
commit
4c2dbf7aff
4 changed files with 53 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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}>(.+?)</{tag}>", string, re.DOTALL)
|
||||
if strip:
|
||||
ext_list = [e.strip() for e in ext_list]
|
||||
|
|
|
@ -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)
|
||||
|
|
18
litellm/tests/test_python_38.py
Normal file
18
litellm/tests/test_python_38.py
Normal file
|
@ -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"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue