def select()

in aidial_adapter_vertexai/chat/gemini/prompt/base.py [0:0]


    def select(self, indices: Set[int]) -> Self:
        system_instruction: List[PartT] | None = None
        contents: List[ContentT] = []

        offset = 0
        if self.has_system_instruction and 0 in indices:
            system_instruction = self.system_instruction
            offset += 1

        for idx in range(len(self.contents)):
            if idx + offset in indices:
                contents.append(self.contents[idx])

        if len(self.contents) - 1 + offset not in indices:
            raise RuntimeError("The last user prompt must not be omitted.")

        return self.__class__(
            system_instruction=system_instruction,
            contents=contents,
            tools=self.tools,
            static_tools=self.static_tools,
        )