nip.utils.data.prompt_list_to_array#
- nip.utils.data.prompt_list_to_array(prompt_list: list[PromptMessage], max_prompt_messages: int) Annotated[ndarray[Any, dtype[_ScalarType_co]], 'message field'] [source]#
Convert a prompt in the form of a list of dictionaries to a numpy array.
Each element of the list is a dictionary with keys defined in
PromptMessage
. We convert this to a numpy array with columns corresponding to the keys inPromptMessage
.- Parameters:
prompt_list (list[PromptMessage]) – The list of prompts to convert.
max_prompt_messages (int) – The maximum number messages which can be sent in a prompt to an agent.