
    jIe                       d dl mZ d dlZd dlZddlmZmZ ej        rddlm	Z	m
Z
 ddlmZmZ ddlmZmZ ddlmZmZ dd	lmZmZ dd
lmZmZ ddlmZmZ ddlmZmZ ddl m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z. ddl/m0Z0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z6m7Z7 ddl8m9Z9m:Z: ddl;m<Z<m=Z= ddl>m?Z?m@Z@ ddlAmBZBmCZC ddlDmEZEmFZF ddlGmHZHmIZI ddlJmKZKmLZL ddlMmNZNmOZO  G d d          ZP G d d           ZQdS )!    )annotationsN   )AsyncClientWrapperSyncClientWrapper)AnnotationQueuesClientAsyncAnnotationQueuesClient)"AsyncBlobStorageIntegrationsClientBlobStorageIntegrationsClient)AsyncCommentsClientCommentsClient)AsyncDatasetItemsClientDatasetItemsClient)AsyncDatasetRunItemsClientDatasetRunItemsClient)AsyncDatasetsClientDatasetsClient)AsyncHealthClientHealthClient)AsyncIngestionClientIngestionClient)AsyncLegacyClientLegacyClient)AsyncLlmConnectionsClientLlmConnectionsClient)AsyncMediaClientMediaClient)AsyncMetricsClientMetricsClient)AsyncModelsClientModelsClient)AsyncObservationsClientObservationsClient)AsyncOpentelemetryClientOpentelemetryClient)AsyncOrganizationsClientOrganizationsClient)AsyncProjectsClientProjectsClient)AsyncPromptVersionClientPromptVersionClient)AsyncPromptsClientPromptsClient)AsyncScimClient
ScimClient)AsyncScoreConfigsClientScoreConfigsClient)AsyncScoresClientScoresClient)AsyncSessionsClientSessionsClient)AsyncTraceClientTraceClientc            
      @   e Zd ZdZdddddddddd	d/dZed             Zed             Zed             Zed             Z	ed             Z
ed             Zed             Zed             Zed             Zed              Zed!             Zed"             Zed#             Zed$             Zed%             Zed&             Zed'             Zed(             Zed)             Zed*             Zed+             Zed,             Zed-             Zed.             ZdS )0LangfuseAPIa  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : str
        The base url to use for requests from the client.

    x_langfuse_sdk_name : typing.Optional[str]
    x_langfuse_sdk_version : typing.Optional[str]
    x_langfuse_public_key : typing.Optional[str]
    username : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
    password : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.Client]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from langfuse import LangfuseAPI

    client = LangfuseAPI(
        x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME",
        x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION",
        x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY",
        username="YOUR_USERNAME",
        password="YOUR_PASSWORD",
        base_url="https://yourhost.com/path/to/api",
    )
    NT	x_langfuse_sdk_namex_langfuse_sdk_versionx_langfuse_public_keyusernamepasswordheaderstimeoutfollow_redirectshttpx_clientbase_urlstrr:   typing.Optional[str]r;   r<   r=   <typing.Optional[typing.Union[str, typing.Callable[[], str]]]r>   r?   &typing.Optional[typing.Dict[str, str]]r@   typing.Optional[float]rA   typing.Optional[bool]rB   typing.Optional[httpx.Client]c       
           ||n|
dn|
j         j        }t          ||||||||
|
n,|	t          j        ||	          nt          j        |          |	  	        | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d S N<   )r@   rA   )r@   )	rC   r:   r;   r<   r=   r>   r?   rB   r@   )r@   readr   httpxClient_client_wrapper_annotation_queues_blob_storage_integrations	_comments_dataset_items_dataset_run_items	_datasets_health
_ingestion_legacy_llm_connections_media_metrics_models_observations_opentelemetry_organizations	_projects_prompt_version_prompts_scim_score_configs_scores	_sessions_traceselfrC   r:   r;   r<   r=   r>   r?   r@   rA   rB   _defaulted_timeouts               c/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/langfuse/api/client.py__init__zLangfuseAPI.__init__V   si     " G # %* 	  1 3#9"7' &
  + *=M    &8999& 
  
  
" LP  	' ;?CGJN:>6:<@6:GK488<6:BFDHDH:>EI8<26
CG6::>48    c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   client_wrapper)rR   annotation_queues.clientr   rQ   )rk   r   s     rm   annotation_queueszLangfuseAPI.annotation_queues   sH    "*HHHHHH&<&<#3' ' 'D# &&ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r
   rq   )rS    blob_storage_integrations.clientr
   rQ   )rk   r
   s     rm   blob_storage_integrationsz%LangfuseAPI.blob_storage_integrations   sH    *2WWWWWW.K.K#3/ / /D+ ..ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rT   comments.clientr   rQ   )rk   r   s     rm   commentszLangfuseAPI.comments   ;    >!777777+^4;OPPPDN~ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rU   dataset_items.clientr   rQ   )rk   r   s     rm   dataset_itemszLangfuseAPI.dataset_items   H    &@@@@@@"4"4#3# # #D ""ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rV   dataset_run_items.clientr   rQ   )rk   r   s     rm   dataset_run_itemszLangfuseAPI.dataset_run_items   sH    "*GGGGGG&;&;#3' ' 'D# &&ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rW   datasets.clientr   rQ   )rk   r   s     rm   datasetszLangfuseAPI.datasets   r{   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rX   health.clientr   rQ   )rk   r   s     rm   healthzLangfuseAPI.health   ;    <333333'<t7KLLLDL|ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rY   ingestion.clientr   rQ   )rk   r   s     rm   	ingestionzLangfuseAPI.ingestion   s;    ?"999999-oT=QRRRDOro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rZ   legacy.clientr   rQ   )rk   r   s     rm   legacyzLangfuseAPI.legacy   r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r[   llm_connections.clientr   rQ   )rk   r   s     rm   llm_connectionszLangfuseAPI.llm_connections   sH     (DDDDDD$8$8#3% % %D! $$ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r\   media.clientr   rQ   )rk   r   s     rm   mediazLangfuseAPI.media   ;    ;111111%+T5IJJJDK{ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r]   metrics.clientr   rQ   )rk   r   s     rm   metricszLangfuseAPI.metrics   ;    = 555555)M9MNNNDM}ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r    rq   )r^   models.clientr    rQ   )rk   r    s     rm   modelszLangfuseAPI.models  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r"   rq   )r_   observations.clientr"   rQ   )rk   r"   s     rm   observationszLangfuseAPI.observations	  s?    %??????!3!34CW!X!X!XD!!ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r$   rq   )r`   opentelemetry.clientr$   rQ   )rk   r$   s     rm   opentelemetryzLangfuseAPI.opentelemetry  H    &AAAAAA"5"5#3# # #D ""ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r&   rq   )ra   organizations.clientr&   rQ   )rk   r&   s     rm   organizationszLangfuseAPI.organizations  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r(   rq   )rb   projects.clientr(   rQ   )rk   r(   s     rm   projectszLangfuseAPI.projects%  r{   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r*   rq   )rc   prompt_version.clientr*   rQ   )rk   r*   s     rm   prompt_versionzLangfuseAPI.prompt_version-  sH    'BBBBBB#6#6#3$ $ $D  ##ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r,   rq   )rd   prompts.clientr,   rQ   )rk   r,   s     rm   promptszLangfuseAPI.prompts7  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r.   rq   )re   scim.clientr.   rQ   )rk   r.   s     rm   scimzLangfuseAPI.scim?  s;    ://////#43GHHHDJzro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r0   rq   )rf   score_configs.clientr0   rQ   )rk   r0   s     rm   score_configszLangfuseAPI.score_configsG  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r2   rq   )rg   scores.clientr2   rQ   )rk   r2   s     rm   scoreszLangfuseAPI.scoresQ  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r4   rq   )rh   sessions.clientr4   rQ   )rk   r4   s     rm   sessionszLangfuseAPI.sessionsY  r{   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r6   rq   )ri   trace.clientr6   rQ   )rk   r6   s     rm   tracezLangfuseAPI.tracea  r   ro   )rC   rD   r:   rE   r;   rE   r<   rE   r=   rF   r>   rF   r?   rG   r@   rH   rA   rI   rB   rJ   __name__
__module____qualname____doc__rn   propertyrt   rw   rz   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    ro   rm   r8   r8   .   s       % %V 597;6:QUQU:>*.266:?9 ?9 ?9 ?9 ?9 ?9B ' ' X' / / X/   X # # X# ' ' X'   X   X   X   X % % X%   X   X   X " " X" # # X# # # X#   X $ $ X$   X   X # # X#   X   X   X  ro   r8   c            
      @   e Zd ZdZdddddddddd	d/dZed             Zed             Zed             Zed             Z	ed             Z
ed             Zed             Zed             Zed             Zed              Zed!             Zed"             Zed#             Zed$             Zed%             Zed&             Zed'             Zed(             Zed)             Zed*             Zed+             Zed,             Zed-             Zed.             ZdS )0AsyncLangfuseAPIa  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    base_url : str
        The base url to use for requests from the client.

    x_langfuse_sdk_name : typing.Optional[str]
    x_langfuse_sdk_version : typing.Optional[str]
    x_langfuse_public_key : typing.Optional[str]
    username : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
    password : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.AsyncClient]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from langfuse import AsyncLangfuseAPI

    client = AsyncLangfuseAPI(
        x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME",
        x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION",
        x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY",
        username="YOUR_USERNAME",
        password="YOUR_PASSWORD",
        base_url="https://yourhost.com/path/to/api",
    )
    NTr9   rC   rD   r:   rE   r;   r<   r=   rF   r>   r?   rG   r@   rH   rA   rI   rB   "typing.Optional[httpx.AsyncClient]c       
           ||n|
dn|
j         j        }t          ||||||||
|
n,|	t          j        ||	          nt          j        |          |	  	        | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d S rL   )r@   rN   r   rO   AsyncClientrQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   s               rm   rn   zAsyncLangfuseAPI.__init__  sm     " G # %* 	  2 3#9"7' &
  + "*=M    "+=>>>& 
  
  
" QU  	' @DHLOS?C;?AE;?LP9==A;?GKIMIM?CJN=A7;
HL;??C9=ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rR   rs   r   rQ   )rk   r   s     rm   rt   z"AsyncLangfuseAPI.annotation_queues  sH    "*MMMMMM&A&A#3' ' 'D# &&ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r	   rq   )rS   rv   r	   rQ   )rk   r	   s     rm   rw   z*AsyncLangfuseAPI.blob_storage_integrations  sW    *2      /Q.P#3/ / /D+ ..ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rT   ry   r   rQ   )rk   r   s     rm   rz   zAsyncLangfuseAPI.comments  <    >!<<<<<<00@TUUUDN~ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rU   r}   r   rQ   )rk   r   s     rm   r~   zAsyncLangfuseAPI.dataset_items  H    &EEEEEE"9"9#3# # #D ""ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rV   r   r   rQ   )rk   r   s     rm   r   z"AsyncLangfuseAPI.dataset_run_items  sH    "*LLLLLL&@&@#3' ' 'D# &&ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rW   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.datasets  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rX   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.health  <    <888888,,D<PQQQDL|ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rY   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.ingestion  s<    ?">>>>>>22$BVWWWDOro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )rZ   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.legacy  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r[   r   r   rQ   )rk   r   s     rm   r   z AsyncLangfuseAPI.llm_connections%  sH     (IIIIII$=$=#3% % %D! $$ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r\   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.media/  <    ;666666**$:NOOODK{ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r]   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.metrics7  <    = ::::::..d>RSSSDM}ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r   rq   )r^   r   r   rQ   )rk   r   s     rm   r   zAsyncLangfuseAPI.models?  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r!   rq   )r_   r   r!   rQ   )rk   r!   s     rm   r   zAsyncLangfuseAPI.observationsG  sH    %DDDDDD!8!8#3" " "D !!ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r#   rq   )r`   r   r#   rQ   )rk   r#   s     rm   r   zAsyncLangfuseAPI.opentelemetryQ  H    &FFFFFF":":#3# # #D ""ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r%   rq   )ra   r   r%   rQ   )rk   r%   s     rm   r   zAsyncLangfuseAPI.organizations[  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r'   rq   )rb   r   r'   rQ   )rk   r'   s     rm   r   zAsyncLangfuseAPI.projectse  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r)   rq   )rc   r   r)   rQ   )rk   r)   s     rm   r   zAsyncLangfuseAPI.prompt_versionm  sH    'GGGGGG#;#;#3$ $ $D  ##ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r+   rq   )rd   r   r+   rQ   )rk   r+   s     rm   r   zAsyncLangfuseAPI.promptsw  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r-   rq   )re   r   r-   rQ   )rk   r-   s     rm   r   zAsyncLangfuseAPI.scim  s;    :444444(8LMMMDJzro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r/   rq   )rf   r   r/   rQ   )rk   r/   s     rm   r   zAsyncLangfuseAPI.score_configs  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r1   rq   )rg   r   r1   rQ   )rk   r1   s     rm   r   zAsyncLangfuseAPI.scores  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r3   rq   )rh   r   r3   rQ   )rk   r3   s     rm   r   zAsyncLangfuseAPI.sessions  r   ro   c                V    | j         ddlm}  || j                  | _         | j         S )Nr   )r5   rq   )ri   r   r5   rQ   )rk   r5   s     rm   r   zAsyncLangfuseAPI.trace  r   ro   )rC   rD   r:   rE   r;   rE   r<   rE   r=   rF   r>   rF   r?   rG   r@   rH   rA   rI   rB   r   r   r   ro   rm   r   r   j  s       % %V 597;6:QUQU:>*.26;??> ?> ?> ?> ?> ?>B ' ' X' 	/ 	/ X	/   X # # X# ' ' X'   X   X   X   X % % X%   X   X   X " " X" # # X# # # X#   X $ $ X$   X   X # # X#   X   X   X  ro   r   )R
__future__r   typingrO   core.client_wrapperr   r   TYPE_CHECKINGrs   r   r   rv   r	   r
   ry   r   r   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r!   r"   r   r#   r$   r   r%   r&   r   r'   r(   r   r)   r*   r   r+   r,   r   r-   r.   r   r/   r0   r   r1   r2   r   r3   r4   r   r5   r6   r8   r   r   ro   rm   <module>r      s1   # " " " " "   F F F F F F F F	 !<               EDDDDDDDQQQQQQQQ        EDDDDDDD>>>>>>>>GGGGGGGG>>>>>>>>WWWWWWWW;;;;;;;;AAAAAAAA>>>>>>>>PPPPPPPPSSSSSSSSSSSSSSSSDDDDDDDDTTTTTTTTAAAAAAAA88888888QQQQQQQQ>>>>>>>>DDDDDDDD;;;;;;;;y y y y y y y yx	} } } } } } } } } }ro   