def select()

in aidial_adapter_vertexai/chat/bison/prompt.py [0:0]


    def select(self, indices: Set[int]) -> "BisonPrompt":
        system_instruction: str | None = None
        history: List[ChatMessage] = []

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

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

        if offset not in indices:
            raise RuntimeError("The last user prompt must not be omitted.")

        return BisonPrompt(
            system_instruction=system_instruction,
            history=history,
            last_user_message=self.last_user_message,
        )