Converts a list of text strings into the input format for the Agent model. Args: texts (List[str]): The list of text strings to be processed. Returns: List[Dict[str, str]]: A list of dictionaries formatted for the Agent model.
(texts: List[str])
| 8 | |
| 9 | |
| 10 | def _prepare_text_inputs(texts: List[str]) -> List[Dict[str, str]]: |
| 11 | """ |
| 12 | Converts a list of text strings into the input format for the Agent model. |
| 13 | |
| 14 | Args: |
| 15 | texts (List[str]): The list of text strings to be processed. |
| 16 | |
| 17 | Returns: |
| 18 | List[Dict[str, str]]: A list of dictionaries formatted for the Agent model. |
| 19 | """ |
| 20 | inputs = [] |
| 21 | # Add each text string to the inputs |
| 22 | if isinstance(texts, str): |
| 23 | texts = [texts] |
| 24 | for text in texts: |
| 25 | inputs.append({ |
| 26 | "type": "text", |
| 27 | "content": text |
| 28 | }) |
| 29 | return inputs |
| 30 | |
| 31 | def _prepare_text_image_inputs(texts: Union[str, List[str]], images: Union[str, Image.Image, List[Union[str, Image.Image]]]) -> List[Dict[str, str]]: |
| 32 | """ |
no outgoing calls
no test coverage detected