mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
feat(databricks/chat): support structured outputs on databricks
Closes https://github.com/BerriAI/litellm/pull/6978 - handles content as list for dbrx, - handles streaming+response_format for dbrx
This commit is contained in:
parent
12aea45447
commit
0caf804f4c
18 changed files with 538 additions and 193 deletions
|
@ -37,6 +37,22 @@ def handle_messages_with_content_list_to_str_conversion(
|
|||
return messages
|
||||
|
||||
|
||||
def strip_name_from_messages(
|
||||
messages: List[AllMessageValues],
|
||||
) -> List[AllMessageValues]:
|
||||
"""
|
||||
Removes 'name' from messages
|
||||
"""
|
||||
new_messages = []
|
||||
for message in messages:
|
||||
msg_role = message.get("role")
|
||||
msg_copy = message.copy()
|
||||
if msg_role == "user":
|
||||
msg_copy.pop("name", None) # type: ignore
|
||||
new_messages.append(msg_copy)
|
||||
return new_messages
|
||||
|
||||
|
||||
def convert_content_list_to_str(message: AllMessageValues) -> str:
|
||||
"""
|
||||
- handles scenario where content is list and not string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue