messages: List[List[BaseMessage]],
        *,
        run_id: UUID,
        parent_run_id: Union[UUID, None] = None,
        tags: Union[List[str], None] = None,
        metadata: Union[Dict[str, Any], None] = None,
        **kwargs: Any,
    ) -> Any:
        user_id = _get_user_id(metadata)
        user_props = _get_user_props(metadata)
        event = {
            "event": "start",
            "type": "llm",
            "userId": user_id,
            "runId": str(run_id),
            "parentRunId": str(parent_run_id) if parent_run_id else None,
            "input": _parse_lc_messages(messages[0]),
            "name": kwargs.get("invocation_params", {}).get("model_name"),
            "tags": tags,
            "metadata": metadata,
        }
        if user_props:
            event["userProps"] = user_props
        self.__send_event(event)
[docs]    def on_llm_end(
        self,
        response: LLMResult,
        *,
        run_id: UUID,
        parent_run_id: Union[UUID, None] = None,
        **kwargs: Any,
    ) -> None:
        token_usage = (response.llm_output or {}).get("token_usage", {})
        parsed_output = [
            {
                "text": generation.text,
                "role": "ai",
                **(
                    {
                        "functionCall": generation.message.additional_kwargs[
                            "function_call"
                        ]
                    }
                    if hasattr(generation, "message")
                    and hasattr(generation.message, "additional_kwargs")
                    and "function_call" in generation.message.additional_kwargs