
    
!i"                       S SK Jr  S SKJrJrJr  S SKJs  Jr	  S SK
Jr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr      S         SS
 jjr    S         SS jjr  S       SS jjr  S       SS jjr   S       SS jjr   S       SS jjrSSSS.       SS jjrSSSS.       SS jjrg)    )annotations)AsyncIterableIterableOptionalN)protos)get_default_retriever_client)"get_default_retriever_async_client)helper_types)idecode_time)retriever_typesc                    Uc  0 nUc
  [        5       nU c  [        R                  " US9nOd[        R                  " U 5      (       a  [        R                  " SU  3US9nO0[        [        R                  R                  [        U 5      U S95      e[        R                  " US9nUR                  " U40 UD6n[        U5      R                  U5      n[        US5        [        US5        [        R                  " S0 UD6nU$ )	a  Calls the API to create a new `Corpus` by specifying either a corpus resource name as an ID or a display name, and returns the created `Corpus`.

Args:
    name: The corpus resource name (ID). The name must be alphanumeric and fewer
        than 40 characters.
    display_name: The human readable display name. The display name must be fewer
        than 128 characters. All characters, including alphanumeric, spaces, and
        dashes are supported.
    request_options: Options for the request.

Return:
    `retriever_types.Corpus` object with specified name or display name.

Raises:
    ValueError: When the name is not specified or formatted incorrectly.
display_namecorpora/namer   lengthr   corpuscreate_timeupdate_time )r   r   Corpusr   
valid_name
ValueErrorNAME_ERROR_MSGformatlenCreateCorpusRequestcreate_corpustypeto_dictr   r   r   clientrequest_optionsr   requestresponses          W/home/james-whalen/.local/lib/python3.13/site-packages/google/generativeai/retriever.pyr!   r!      s    , ~-/|L9		#	#D	)	)htf$5LQ77>>c$iVZ>[\\((7G##G??HH~%%h/H=)=)%%11HO    c                  #    Uc  0 nUc
  [        5       nU c  [        R                  " US9nOd[        R                  " U 5      (       a  [        R                  " SU  3US9nO0[        [        R                  R                  [        U 5      U S95      e[        R                  " US9nUR                  " U40 UD6I Sh  vN n[        U5      R                  U5      n[        US5        [        US5        [        R                  " S	0 UD6nU$  NN7f)
z7This is the async version of `retriever.create_corpus`.Nr   r   r   r   r   r   r   r   )r	   r   r   r   r   r   r   r   r   r    r!   r"   r#   r   r$   s          r)   create_corpus_asyncr,   J   s      ~35|L9		#	#D	)	)htf$5LQ77>>c$iVZ>[\\((7G))'E_EEHH~%%h/H=)=)%%11HO Fs   B9D;D
<ADc                   Uc  0 nUc
  [        5       nSU ;  a  SU -   n [        R                  " U S9nUR                  " U40 UD6n[	        U5      R                  U5      n[        US5        [        US5        [        R                  " S0 UD6nU$ )zCalls the API to fetch a `Corpus` by name and returns the `Corpus`.

Args:
    name: The `Corpus` name.
    request_options: Options for the request.

Return:
    a `retriever_types.Corpus` of interest.
/r   r   r   r   r   )	r   r   GetCorpusRequest
get_corpusr"   r#   r   r   r   r   r%   r&   r'   r(   s        r)   r1   r1   g   s     ~-/
$D %%40G  <O<HH~%%h/H=)=)%%11HOr*   c                :  #    Uc  0 nUc
  [        5       nSU ;  a  SU -   n [        R                  " U S9nUR                  " U40 UD6I Sh  vN n[	        U5      R                  U5      n[        US5        [        US5        [        R                  " S0 UD6nU$  NN7f)z4This is the async version of `retriever.get_corpus`.Nr.   r   r/   r   r   r   )	r	   r   r0   r1   r"   r#   r   r   r   r2   s        r)   get_corpus_asyncr4      s      ~35
$D %%40G&&wB/BBHH~%%h/H=)=)%%11HO Cs   AB
BABc                    Uc  0 nUc
  [        5       nSU ;  a  SU -   n [        R                  " XS9nUR                  " U40 UD6  g)aN  Calls the API to remove a `Corpus` from the service, optionally deleting associated `Document`s and objects if the `force` parameter is set to true.

Args:
    name: The `Corpus` name.
    force: If set to true, any `Document`s and objects related to this `Corpus` will also be deleted.
    request_options: Options for the request.

Nr.   r   r   force)r   r   DeleteCorpusRequestdelete_corpusr   r7   r%   r&   r'   s        r)   r9   r9      sP     ~-/
$D ((d@G
4O4r*   c                   #    Uc  0 nUc
  [        5       nSU ;  a  SU -   n [        R                  " XS9nUR                  " U40 UD6I Sh  vN   g N7f)z7This is the async version of `retriever.delete_corpus`.Nr.   r   r6   )r	   r   r8   r9   r:   s        r)   delete_corpus_asyncr<      sY      ~35
$D ((d@G


w
:/
:::s   AA
AA)	page_sizer%   r&   c              #     #    Uc  0 nUc
  [        5       n[        R                  " U S9nUR                  " U40 UD6 HM  n[	        U5      R                  U5      n[        US5        [        US5        [        R                  " S0 UD6v   MO     g7f)a=  Calls the API to list all `Corpora` in the service and returns a list of paginated `Corpora`.

Args:
    page_size: Maximum number of `Corpora` to request.
    page_token: A page token, received from a previous ListCorpora call.
    request_options: Options for the request.

Return:
    Paginated list of `Corpora`.
Nr=   r   r   r   )	r   r   ListCorporaRequestlist_corporar"   r#   r   r   r   r=   r%   r&   r'   r   s        r)   rA   rA      s       ~-/'')<G%%gAAf%%f-V]+V]+$$.v..	 Bs   BBc               D  #    Uc  0 nUc
  [        5       n[        R                  " U S9nUR                  " U40 UD6I Sh  vN   Sh  vN n[	        U5      R                  U5      n[        US5        [        US5        [        R                  " S0 UD67v   MV   NZ NS
 g7f)z6This is the async version of `retriever.list_corpora`.Nr?   r   r   r   )	r	   r   r@   rA   r"   r#   r   r   r   rB   s        r)   list_corpora_asyncrD      s      ~35'')<G$11'M_MMM /ff%%f-V]+V]+$$.v..	 N /Ms5   =B B B BB	BAB BB )NNNN)
r   
str | Noner   rE   r%   !glm.RetrieverServiceClient | Noner&   &helper_types.RequestOptionsType | Nonereturnretriever_types.Corpus)
r   rE   r   rE   r%   &glm.RetrieverServiceAsyncClient | Noner&   rG   rH   rI   )NN)r   strr%   rF   r&   rG   rH   rI   )r   rK   r%   rJ   r&   rG   rH   rI   )FNN)r   rK   r7   boolr%   rF   r&   rG   )r   rK   r7   rL   r%   rJ   r&   rG   )r=   Optional[int]r%   rF   r&   rG   rH   z Iterable[retriever_types.Corpus])r=   rM   r%   rF   r&   rG   rH   z%AsyncIterable[retriever_types.Corpus])
__future__r   typingr   r   r   google.ai.generativelanguageaigenerativelanguageglmgoogle.generativeair   google.generativeai.clientr   r	   google.generativeai.typesr
   %google.generativeai.types.model_typesr   r   r!   r,   r1   r4   r9   r<   rA   rD   r   r*   r)   <module>rX      s   # 5 4 * * & C I 2 > 5 #04>B	)
)) .) <	)
 )Z #59>B	
 3 <	
 > 15>B
- < 	D 6:>B
2 < 	6 04>B	5
55 .5 <	5: 59>B	;
;; 3; <	;,  $04>B	// ./ <	/
 &/@  $04>B	// ./ <	/
 +/r*   