-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade litellm 1.52.8 for Snyk (#360)
* upgrade litellm 1.52.8 * separate litellm test in test workflow * test openai compatiblity in CI * create separate magentic perplexity test and use log10 callback * tmp skip anthropic completions test * try to show color for pytest in gh action * switch to perplexity chat model in tests * test only run test_magentic_perplexity.py * add 3sec delay to check logs * found that magentic perplexity tests passes when only run those test to run the rest of the tests * ignore test_magentic_perplexity.py * run test_magentic_perplexity.py separately * pass perplexity model with openai_compatibility_model
- Loading branch information
1 parent
636c2a9
commit 331015c
Showing
5 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import time | ||
|
||
import litellm | ||
import pytest | ||
from magentic import StreamedStr, prompt | ||
from magentic.chat_model.litellm_chat_model import LitellmChatModel | ||
|
||
from log10.litellm import Log10LitellmLogger | ||
from tests.utils import _LogAssertion | ||
|
||
|
||
log10_handler = Log10LitellmLogger(tags=["litellm_perplexity"]) | ||
litellm.callbacks = [log10_handler] | ||
|
||
|
||
@pytest.mark.chat | ||
def test_prompt(session, openai_compatibility_model): | ||
@prompt("What happened on this day?", model=LitellmChatModel(model=openai_compatibility_model)) | ||
def llm() -> str: ... | ||
|
||
output = llm() | ||
assert isinstance(output, str) | ||
|
||
time.sleep(3) | ||
|
||
_LogAssertion(completion_id=session.last_completion_id(), message_content=output).assert_chat_response() | ||
|
||
|
||
@pytest.mark.chat | ||
@pytest.mark.stream | ||
def test_prompt_stream(session, openai_compatibility_model): | ||
@prompt("What happened on this day?", model=LitellmChatModel(model=openai_compatibility_model)) | ||
def llm() -> StreamedStr: ... | ||
|
||
response = llm() | ||
output = "" | ||
for chunk in response: | ||
output += chunk | ||
_LogAssertion(completion_id=session.last_completion_id(), message_content=output).assert_chat_response() |