AdalFlow icon indicating copy to clipboard operation
AdalFlow copied to clipboard

Support passing a list of message to LLM model

Open zjffdu opened this issue 7 months ago • 3 comments

Is your feature request related to a problem? Please describe. Currently I can only pass one string to Generator, but openai support a list of message which is what I want.

Describe the solution you'd like I'd like to support a list of messages like following:

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Who won the World Series in 2020?"},
    {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
    {"role": "user", "content": "Who was the MVP?"},
]

# Call the ChatCompletion.create method with the messages
response = openai.ChatCompletion.create(
    model="gpt-4",  # Use "gpt-4" or "gpt-3.5-turbo" depending on your model availability
    messages=messages
)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

zjffdu avatar Jul 19 '24 14:07 zjffdu