
    j6                     j    d dl mZmZmZ ddlmZ ddlmZ  ede      Z	 ddee   d	eegef   fd
Z	y)    )CallableOptionalTypeVar   )litellm_completion_decorator)completion_chunks_aggregatorF)boundNproject_namereturnc                 p    t        j                         }|j                  dd| t        j                        S )a  Decorator for tracking LiteLLM function calls with Opik.

    Can be used within other Opik-tracked functions to create proper span hierarchy.

    Supported (streaming and non-streaming modes):
    * `litellm.completion`
    * `litellm.acompletion`

    Example:
        ```python
        import litellm
        from opik.integrations.litellm import track_completion

        tracked_completion = track_completion(project_name="my-project")(litellm.completion)
        response = tracked_completion(model="gpt-3.5-turbo", messages=[...])
        ```

    Args:
        project_name: The name of the project to log data.

    Returns:
        Decorator function that wraps the completion function with Opik tracking.
    llmN)typenamer   generations_aggregator)r   LiteLLMCompletionTrackDecoratortrackr   	aggregate)r   decorator_factorys     /Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/integrations/litellm/opik_tracker.pytrack_completionr   	   s=    6 5TTV""!;EE	 #      )N)
typingr   r   r    r   r   r	   strr    r   r   <module>r      sF    . . * *Cx  #'"3-"qc1f"r   