o
    è²ªgÏ  ã                   @  s6   d Z ddlmZ ddlmZ ddlmZ dd	d
„ZdS )zFunction for de-duping results.é    )Úannotations)ÚSequence)Úllmfn_output_rowÚrowsú-Sequence[llmfn_output_row.LLMFnOutputRowView]ÚreturnúSequence[int]c                 C  sF   g }t ƒ }t| ƒD ]\}}| ¡ }||v rq	| |¡ | |¡ q	|S )ag  Returns a list of indices with duplicates removed.

    E.g. if rows has results ["hello", "hello", "world"], the return value would
    be [0, 2], indicating that the results at index 1 is a duplicate and should be
    removed.

    Args:
      rows: The input rows

    Returns:
      A sequence of indices indicating which entries have unique results.
    )ÚsetÚ	enumerateÚresult_valueÚaddÚappend)r   ÚindicesÚseen_entriesÚidxÚrowÚvalue© r   úf/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/google/generativeai/notebook/lib/unique_fn.pyÚ	unique_fn   s   
r   N)r   r   r   r   )Ú__doc__Ú
__future__r   Útypingr   Ú google.generativeai.notebook.libr   r   r   r   r   r   Ú<module>   s
   