Spaces:
Runtime error
Runtime error
File size: 387 Bytes
5dfdf10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from langchain_core.tools import tool
@tool
def sort_items_and_format(items: list[str]) -> str:
"""
Alphabetize a set of words.
Parameters
----------
items : list
Words to bet sorted
Returns:
str: Alphabetized and formated text
"""
sorted_items = sorted(items, key=lambda x: x.split()[0].lower())
return ", ".join(sorted_items)
|