Fix LibraryClient completely correctly; also make tests pass

This commit is contained in:
Ashwin Bharambe 2024-12-16 22:16:21 -08:00
parent d4935ca439
commit 1bcc26ccd1
7 changed files with 201 additions and 100 deletions

View file

@ -4,10 +4,23 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import sys
import traceback
import warnings
import pytest
from llama_stack_client.lib.inference.event_logger import EventLogger
def warn_with_traceback(message, category, filename, lineno, file=None, line=None):
log = file if hasattr(file, "write") else sys.stderr
traceback.print_stack(file=log)
log.write(warnings.formatwarning(message, category, filename, lineno, line))
warnings.showwarning = warn_with_traceback
def test_text_chat_completion(llama_stack_client):
# non-streaming
available_models = [
@ -55,11 +68,15 @@ def test_image_chat_completion(llama_stack_client):
"role": "user",
"content": [
{
"image": {
"type": "image",
"data": {
"uri": "https://www.healthypawspetinsurance.com/Images/V3/DogAndPuppyInsurance/Dog_CTA_Desktop_HeroImage.jpg"
}
},
},
{
"type": "text",
"text": "Describe what is in this image.",
},
"Describe what is in this image.",
],
}
response = llama_stack_client.inference.chat_completion(