Skip to content

Commit 3135d80

Browse files
committed
Fix poem generation example compatibility
1 parent d412f23 commit 3135d80

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎examples/poem-generation/simple_poem.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
# Use GPT-4o-mini for this example.
99
llm = curator.LLM(model_name="gpt-4o-mini")
1010
poem = llm(["Write a poem about the importance of data in AI."])
11-
print(poem.to_pandas().iloc[0]["response"])
11+
print(poem.dataset.to_pandas().iloc[0]["response"])
1212

1313
# Use Claude 3.5 Sonnet for this example.
14-
llm = curator.LLM(model_name="claude-3-5-sonnet-20240620", backend="litellm")
14+
llm = curator.LLM(model_name="claude-sonnet-4-20250514", backend="anthropic")
1515
poem = llm(["Write a poem about the importance of data in AI."])
16-
print(poem.to_pandas().iloc[0]["response"])
16+
print(poem.dataset.to_pandas().iloc[0]["response"])
1717

1818
# Note that we can also pass a list of prompts to generate multiple responses.
1919
poems = llm(

‎src/bespokelabs/curator/llm/llm.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,11 @@ def _write_fast_path_failed_requests(
571571
return failed_requests_path
572572

573573

574-
def _is_message_list(list: list) -> bool:
574+
def _is_message_list(value: Any) -> bool:
575575
"""Check if a list is a list of messages."""
576-
return all(isinstance(item, dict) and "role" in item and "content" in item for item in list)
576+
if not isinstance(value, list):
577+
return False
578+
return all(isinstance(item, dict) and "role" in item and "content" in item for item in value)
577579

578580

579581
def _raw_input_to_rows(raw_input) -> list[dict]:

0 commit comments

Comments
 (0)