Merge pull request #9333 from BerriAI/litellm_dev_03_17_2025_p2

fix(ollama/completions/transformation.py): pass prompt, untemplated o…
This commit is contained in:
Krish Dholakia 2025-03-17 21:48:30 -07:00 committed by GitHub
commit cd5024f3b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 6 deletions

View file

@ -77,6 +77,16 @@ def convert_content_list_to_str(message: AllMessageValues) -> str:
return texts
def get_str_from_messages(messages: List[AllMessageValues]) -> str:
"""
Converts a list of messages to a string
"""
text = ""
for message in messages:
text += convert_content_list_to_str(message=message)
return text
def is_non_content_values_set(message: AllMessageValues) -> bool:
ignore_keys = ["content", "role", "name"]
return any(

View file

@ -181,7 +181,7 @@ def _handle_ollama_system_message(
def ollama_pt(
model, messages
model: str, messages: list
) -> Union[
str, OllamaVisionModelObject
]: # https://github.com/ollama/ollama/blob/af4cf55884ac54b9e637cd71dadfe9b7a5685877/docs/modelfile.md#template