Quick Tour

Installation

pip install bespokelabs-curator

Hello World with LLM

The LLMclass provides a flexible interface to generate data with LLMs. Below is a minimal example of using LLM: we simply create an LLM object with a model_name, in this case gpt-4o-mini, and passing in a prompt.

from bespokelabs import curator
llm = curator.LLM(model_name="gpt-4o-mini")
poem = llm("Write a poem about the importance of data in AI.")
print(poem.to_pandas())
# Output:
#                                             response
# 0  In the realm where silence once held sway,  \n...

# Or you can pass a list of prompts to generate multiple responses.
poems = llm(["Write a poem about the importance of data in AI.",
            "Write a haiku about the importance of data in AI."])
print(poems.dataset.to_pandas())
# Output:
#                                             response
# 0  In the realm where silence once held sway,  \n...
# 1  Silent streams of truth,  \nData shapes the le...

What's next?

  • Check out the key concepts of the library in Key Concepts

  • See important caching feature avail

Last updated